Crazy Eddies GUI System 0.7.5

CEGUIOgreRenderer.h

00001 /***********************************************************************
00002     filename:   CEGUIOgreRenderer.h
00003     created:    Tue Feb 17 2009
00004     author:     Paul D Turner
00005 *************************************************************************/
00006 /***************************************************************************
00007  *   Copyright (C) 2004 - 2010 Paul D Turner & The CEGUI Development Team
00008  *
00009  *   Permission is hereby granted, free of charge, to any person obtaining
00010  *   a copy of this software and associated documentation files (the
00011  *   "Software"), to deal in the Software without restriction, including
00012  *   without limitation the rights to use, copy, modify, merge, publish,
00013  *   distribute, sublicense, and/or sell copies of the Software, and to
00014  *   permit persons to whom the Software is furnished to do so, subject to
00015  *   the following conditions:
00016  *
00017  *   The above copyright notice and this permission notice shall be
00018  *   included in all copies or substantial portions of the Software.
00019  *
00020  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00021  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00022  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00023  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
00024  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00025  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00026  *   OTHER DEALINGS IN THE SOFTWARE.
00027  ***************************************************************************/
00028 #ifndef _CEGUIOgreRenderer_h_
00029 #define _CEGUIOgreRenderer_h_
00030 
00031 #include "../../CEGUIRenderer.h"
00032 #include "../../CEGUISize.h"
00033 #include "../../CEGUIVector.h"
00034 
00035 #include <vector>
00036 
00037 #if (defined( __WIN32__ ) || defined( _WIN32 )) && !defined(CEGUI_STATIC)
00038 #   ifdef OGRE_GUIRENDERER_EXPORTS
00039 #       define OGRE_GUIRENDERER_API __declspec(dllexport)
00040 #   else
00041 #       define OGRE_GUIRENDERER_API __declspec(dllimport)
00042 #   endif
00043 #else
00044 #   define OGRE_GUIRENDERER_API
00045 #endif
00046 
00047 #if defined(_MSC_VER)
00048 #   pragma warning(push)
00049 #   pragma warning(disable : 4251)
00050 #endif
00051 
00052 namespace Ogre
00053 {
00054 class Root;
00055 class RenderSystem;
00056 class RenderTarget;
00057 class TexturePtr;
00058 }
00059 
00060 // Start of CEGUI namespace section
00061 namespace CEGUI
00062 {
00063 class OgreGeometryBuffer;
00064 class OgreTexture;
00065 class OgreResourceProvider;
00066 class OgreImageCodec;
00067 class OgreWindowTarget;
00068 struct OgreRenderer_impl;
00069 
00071 class OGRE_GUIRENDERER_API OgreRenderer : public Renderer
00072 {
00073 public:
00096     static OgreRenderer& bootstrapSystem();
00097 
00119     static OgreRenderer& bootstrapSystem(Ogre::RenderTarget& target);
00120 
00137     static void destroySystem();
00138 
00149     static OgreRenderer& create();
00150 
00156     static OgreRenderer& create(Ogre::RenderTarget& target);
00157 
00159     static void destroy(OgreRenderer& renderer);
00160 
00162     static OgreResourceProvider& createOgreResourceProvider();
00163 
00165     static void destroyOgreResourceProvider(OgreResourceProvider& rp);
00166 
00168     static OgreImageCodec& createOgreImageCodec();
00169 
00171     static void destroyOgreImageCodec(OgreImageCodec& ic);
00172 
00174     void setRenderingEnabled(const bool enabled);
00175 
00177     bool isRenderingEnabled() const;
00178 
00193     Texture& createTexture(Ogre::TexturePtr& tex, bool take_ownership = false);
00194 
00196     void setupRenderingBlendMode(const BlendMode mode,
00197                                  const bool force = false);
00198 
00216     void setFrameControlExecutionEnabled(const bool enabled);
00217 
00235     bool isFrameControlExecutionEnabled() const;
00236 
00245     void initialiseRenderStateSettings();
00246 
00256     void setDefaultRootRenderTarget(Ogre::RenderTarget& target);
00257 
00258     // implement CEGUI::Renderer interface
00259     RenderingRoot& getDefaultRenderingRoot();
00260     GeometryBuffer& createGeometryBuffer();
00261     void destroyGeometryBuffer(const GeometryBuffer& buffer);
00262     void destroyAllGeometryBuffers();
00263     TextureTarget* createTextureTarget();
00264     void destroyTextureTarget(TextureTarget* target);
00265     void destroyAllTextureTargets();
00266     Texture& createTexture();
00267     Texture& createTexture(const String& filename, const String& resourceGroup);
00268     Texture& createTexture(const Size& size);
00269     void destroyTexture(Texture& texture);
00270     void destroyAllTextures();
00271     void beginRendering();
00272     void endRendering();
00273     void setDisplaySize(const Size& sz);
00274     const Size& getDisplaySize() const;
00275     const Vector2& getDisplayDPI() const;
00276     uint getMaxTextureSize() const;
00277     const String& getIdentifierString() const;
00278 
00279 protected:
00281     OgreRenderer();
00283     OgreRenderer(Ogre::RenderTarget& target);
00285     virtual ~OgreRenderer();
00286 
00288     void checkOgreInitialised();
00289 
00291     void constructor_impl(Ogre::RenderTarget& target);
00292 
00294     OgreRenderer_impl* d_pimpl;
00295 };
00296 
00297 
00298 } // End of  CEGUI namespace section
00299 
00300 #if defined(_MSC_VER)
00301 #   pragma warning(pop)
00302 #endif
00303 
00304 #endif  // end of guard _CEGUIOgreRenderer_h_