Crazy Eddies GUI System  0.7.7
CEGUIOgreRenderer.h
1 /***********************************************************************
2  filename: CEGUIOgreRenderer.h
3  created: Tue Feb 17 2009
4  author: Paul D Turner
5 *************************************************************************/
6 /***************************************************************************
7  * Copyright (C) 2004 - 2010 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 _CEGUIOgreRenderer_h_
29 #define _CEGUIOgreRenderer_h_
30 
31 #include "../../CEGUIRenderer.h"
32 #include "../../CEGUISize.h"
33 #include "../../CEGUIVector.h"
34 
35 #include <vector>
36 
37 #if (defined( __WIN32__ ) || defined( _WIN32 )) && !defined(CEGUI_STATIC)
38 # ifdef OGRE_GUIRENDERER_EXPORTS
39 # define OGRE_GUIRENDERER_API __declspec(dllexport)
40 # else
41 # define OGRE_GUIRENDERER_API __declspec(dllimport)
42 # endif
43 #else
44 # define OGRE_GUIRENDERER_API
45 #endif
46 
47 #if defined(_MSC_VER)
48 # pragma warning(push)
49 # pragma warning(disable : 4251)
50 #endif
51 
52 namespace Ogre
53 {
54 class Root;
55 class RenderSystem;
56 class RenderTarget;
57 class TexturePtr;
58 }
59 
60 // Start of CEGUI namespace section
61 namespace CEGUI
62 {
63 class OgreGeometryBuffer;
64 class OgreTexture;
65 class OgreResourceProvider;
66 class OgreImageCodec;
67 class OgreWindowTarget;
68 struct OgreRenderer_impl;
69 
71 class OGRE_GUIRENDERER_API OgreRenderer : public Renderer
72 {
73 public:
96  static OgreRenderer& bootstrapSystem();
97 
119  static OgreRenderer& bootstrapSystem(Ogre::RenderTarget& target);
120 
137  static void destroySystem();
138 
149  static OgreRenderer& create();
150 
156  static OgreRenderer& create(Ogre::RenderTarget& target);
157 
159  static void destroy(OgreRenderer& renderer);
160 
162  static OgreResourceProvider& createOgreResourceProvider();
163 
165  static void destroyOgreResourceProvider(OgreResourceProvider& rp);
166 
168  static OgreImageCodec& createOgreImageCodec();
169 
171  static void destroyOgreImageCodec(OgreImageCodec& ic);
172 
174  void setRenderingEnabled(const bool enabled);
175 
177  bool isRenderingEnabled() const;
178 
193  Texture& createTexture(Ogre::TexturePtr& tex, bool take_ownership = false);
194 
196  void setupRenderingBlendMode(const BlendMode mode,
197  const bool force = false);
198 
216  void setFrameControlExecutionEnabled(const bool enabled);
217 
235  bool isFrameControlExecutionEnabled() const;
236 
245  void initialiseRenderStateSettings();
246 
256  void setDefaultRootRenderTarget(Ogre::RenderTarget& target);
257 
258  // implement CEGUI::Renderer interface
259  RenderingRoot& getDefaultRenderingRoot();
260  GeometryBuffer& createGeometryBuffer();
261  void destroyGeometryBuffer(const GeometryBuffer& buffer);
262  void destroyAllGeometryBuffers();
263  TextureTarget* createTextureTarget();
264  void destroyTextureTarget(TextureTarget* target);
265  void destroyAllTextureTargets();
266  Texture& createTexture();
267  Texture& createTexture(const String& filename, const String& resourceGroup);
268  Texture& createTexture(const Size& size);
269  void destroyTexture(Texture& texture);
270  void destroyAllTextures();
271  void beginRendering();
272  void endRendering();
273  void setDisplaySize(const Size& sz);
274  const Size& getDisplaySize() const;
275  const Vector2& getDisplayDPI() const;
276  uint getMaxTextureSize() const;
277  const String& getIdentifierString() const;
278 
279 protected:
281  OgreRenderer();
283  OgreRenderer(Ogre::RenderTarget& target);
285  virtual ~OgreRenderer();
286 
288  void checkOgreInitialised();
289 
291  void constructor_impl(Ogre::RenderTarget& target);
292 
294  OgreRenderer_impl* d_pimpl;
295 };
296 
297 
298 } // End of CEGUI namespace section
299 
300 #if defined(_MSC_VER)
301 # pragma warning(pop)
302 #endif
303 
304 #endif // end of guard _CEGUIOgreRenderer_h_