Crazy Eddies GUI System  0.7.9
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
CEGUIOgreRenderer.h
1 /***********************************************************************
2  filename: CEGUIOgreRenderer.h
3  created: Tue Feb 17 2009
4  author: Paul D Turner
5 *************************************************************************/
6 /***************************************************************************
7  * Copyright (C) 2004 - 2013 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 class Matrix4;
59 }
60 
61 // Start of CEGUI namespace section
62 namespace CEGUI
63 {
64 class OgreGeometryBuffer;
65 class OgreTexture;
66 class OgreResourceProvider;
67 class OgreImageCodec;
68 class OgreWindowTarget;
69 struct OgreRenderer_impl;
70 
72 class OGRE_GUIRENDERER_API OgreRenderer : public Renderer
73 {
74 public:
97  static OgreRenderer& bootstrapSystem();
98 
120  static OgreRenderer& bootstrapSystem(Ogre::RenderTarget& target);
121 
138  static void destroySystem();
139 
150  static OgreRenderer& create();
151 
157  static OgreRenderer& create(Ogre::RenderTarget& target);
158 
160  static void destroy(OgreRenderer& renderer);
161 
163  static OgreResourceProvider& createOgreResourceProvider();
164 
166  static void destroyOgreResourceProvider(OgreResourceProvider& rp);
167 
169  static OgreImageCodec& createOgreImageCodec();
170 
172  static void destroyOgreImageCodec(OgreImageCodec& ic);
173 
175  void setRenderingEnabled(const bool enabled);
176 
178  bool isRenderingEnabled() const;
179 
194  Texture& createTexture(Ogre::TexturePtr& tex, bool take_ownership = false);
195 
197  void setupRenderingBlendMode(const BlendMode mode,
198  const bool force = false);
199 
217  void setFrameControlExecutionEnabled(const bool enabled);
218 
236  bool isFrameControlExecutionEnabled() const;
237 
246  void initialiseRenderStateSettings();
247 
257  void setDefaultRootRenderTarget(Ogre::RenderTarget& target);
258 
268  bool isUsingShaders() const;
269 
288  void setUsingShaders(const bool use_shaders);
289 
299  void bindShaders();
300 
308  void updateShaderParams() const;
309 
311  void setWorldMatrix(const Ogre::Matrix4& m);
313  void setViewMatrix(const Ogre::Matrix4& m);
315  void setProjectionMatrix(const Ogre::Matrix4& m);
317  const Ogre::Matrix4& getWorldMatrix() const;
319  const Ogre::Matrix4& getViewMatrix() const;
321  const Ogre::Matrix4& getProjectionMatrix() const;
322 
333  const Ogre::Matrix4& getWorldViewProjMatrix() const;
334 
335  // implement CEGUI::Renderer interface
336  RenderingRoot& getDefaultRenderingRoot();
337  GeometryBuffer& createGeometryBuffer();
338  void destroyGeometryBuffer(const GeometryBuffer& buffer);
339  void destroyAllGeometryBuffers();
340  TextureTarget* createTextureTarget();
341  void destroyTextureTarget(TextureTarget* target);
342  void destroyAllTextureTargets();
343  Texture& createTexture();
344  Texture& createTexture(const String& filename, const String& resourceGroup);
345  Texture& createTexture(const Size& size);
346  void destroyTexture(Texture& texture);
347  void destroyAllTextures();
348  void beginRendering();
349  void endRendering();
350  void setDisplaySize(const Size& sz);
351  const Size& getDisplaySize() const;
352  const Vector2& getDisplayDPI() const;
353  uint getMaxTextureSize() const;
354  const String& getIdentifierString() const;
355 
356 protected:
358  OgreRenderer();
360  OgreRenderer(Ogre::RenderTarget& target);
362  virtual ~OgreRenderer();
363 
365  void checkOgreInitialised();
366 
368  void constructor_impl(Ogre::RenderTarget& target);
370  void initialiseShaders();
372  void cleanupShaders();
373 
375  OgreRenderer_impl* d_pimpl;
376 };
377 
378 
379 } // End of CEGUI namespace section
380 
381 #if defined(_MSC_VER)
382 # pragma warning(pop)
383 #endif
384 
385 #endif // end of guard _CEGUIOgreRenderer_h_