• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List

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 <OgreBlendMode.h>
00036 #include <OgreTextureUnitState.h>
00037 
00038 #include <vector>
00039 
00040 #if (defined( __WIN32__ ) || defined( _WIN32 )) && !defined(CEGUI_STATIC)
00041 #   ifdef OGRE_GUIRENDERER_EXPORTS
00042 #       define OGRE_GUIRENDERER_API __declspec(dllexport)
00043 #   else
00044 #       define OGRE_GUIRENDERER_API __declspec(dllimport)
00045 #   endif
00046 #else
00047 #   define OGRE_GUIRENDERER_API
00048 #endif
00049 
00050 #if defined(_MSC_VER)
00051 #   pragma warning(push)
00052 #   pragma warning(disable : 4251)
00053 #endif
00054 
00055 namespace Ogre
00056 {
00057 class Root;
00058 class RenderSystem;
00059 }
00060 
00061 // Start of CEGUI namespace section
00062 namespace CEGUI
00063 {
00064 class OgreGeometryBuffer;
00065 class OgreTexture;
00066 class OgreResourceProvider;
00067 class OgreImageCodec;
00068 class OgreWindowTarget;
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     static String d_rendererID;
00296     Size d_displaySize;
00298     Vector2 d_displayDPI;
00300     RenderingRoot* d_defaultRoot;
00302     OgreWindowTarget* d_defaultTarget;
00304     typedef std::vector<TextureTarget*> TextureTargetList;
00306     TextureTargetList d_textureTargets;
00308     typedef std::vector<OgreGeometryBuffer*> GeometryBufferList;
00310     GeometryBufferList d_geometryBuffers;
00312     typedef std::vector<OgreTexture*> TextureList;
00314     TextureList d_textures;
00316     uint d_maxTextureSize;
00318     Ogre::Root* d_ogreRoot;
00320     Ogre::RenderSystem* d_renderSystem;
00322     BlendMode d_activeBlendMode;
00324     bool d_makeFrameControlCalls;
00325 };
00326 
00327 
00328 } // End of  CEGUI namespace section
00329 
00330 #if defined(_MSC_VER)
00331 #   pragma warning(pop)
00332 #endif
00333 
00334 #endif  // end of guard _CEGUIOgreRenderer_h_

Generated on Sat Sep 25 2010 02:10:34 for Crazy Eddies GUI System by  doxygen 1.7.1