Crazy Eddie's GUI System
0.8.4
|
00001 /*********************************************************************** 00002 created: Tue Feb 17 2009 00003 author: Paul D Turner 00004 *************************************************************************/ 00005 /*************************************************************************** 00006 * Copyright (C) 2004 - 2013 Paul D Turner & The CEGUI Development Team 00007 * 00008 * Permission is hereby granted, free of charge, to any person obtaining 00009 * a copy of this software and associated documentation files (the 00010 * "Software"), to deal in the Software without restriction, including 00011 * without limitation the rights to use, copy, modify, merge, publish, 00012 * distribute, sublicense, and/or sell copies of the Software, and to 00013 * permit persons to whom the Software is furnished to do so, subject to 00014 * the following conditions: 00015 * 00016 * The above copyright notice and this permission notice shall be 00017 * included in all copies or substantial portions of the Software. 00018 * 00019 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00020 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00021 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00022 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 00023 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 00024 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 00025 * OTHER DEALINGS IN THE SOFTWARE. 00026 ***************************************************************************/ 00027 #ifndef _CEGUIOgreRenderer_h_ 00028 #define _CEGUIOgreRenderer_h_ 00029 00030 #include "../../Renderer.h" 00031 #include "../../Size.h" 00032 #include "../../Vector.h" 00033 #include "CEGUI/Config.h" 00034 00035 #include <vector> 00036 00037 #if (defined( __WIN32__ ) || defined( _WIN32 )) && !defined(CEGUI_STATIC) 00038 # ifdef CEGUIOGRERENDERER_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 #if (CEGUI_OGRE_VERSION < ((1 << 16) | (9 << 8) | 0)) 00058 class TexturePtr; 00059 #else 00060 template<typename T> class SharedPtr; 00061 class Texture; 00062 typedef SharedPtr<Texture> TexturePtr; 00063 #endif 00064 class Matrix4; 00065 } 00066 00067 // Start of CEGUI namespace section 00068 namespace CEGUI 00069 { 00070 class OgreGeometryBuffer; 00071 class OgreTexture; 00072 class OgreResourceProvider; 00073 class OgreImageCodec; 00074 class OgreWindowTarget; 00075 struct OgreRenderer_impl; 00076 00078 class OGRE_GUIRENDERER_API OgreRenderer : public Renderer 00079 { 00080 public: 00106 static OgreRenderer& bootstrapSystem(const int abi = CEGUI_VERSION_ABI); 00107 00132 static OgreRenderer& bootstrapSystem(Ogre::RenderTarget& target, 00133 const int abi = CEGUI_VERSION_ABI); 00134 00151 static void destroySystem(); 00152 00163 static OgreRenderer& create(const int abi = CEGUI_VERSION_ABI); 00164 00170 static OgreRenderer& create(Ogre::RenderTarget& target, 00171 const int abi = CEGUI_VERSION_ABI); 00172 00174 static void destroy(OgreRenderer& renderer); 00175 00177 static OgreResourceProvider& createOgreResourceProvider(); 00178 00180 static void destroyOgreResourceProvider(OgreResourceProvider& rp); 00181 00183 static OgreImageCodec& createOgreImageCodec(); 00184 00186 static void destroyOgreImageCodec(OgreImageCodec& ic); 00187 00189 void setRenderingEnabled(const bool enabled); 00190 00192 bool isRenderingEnabled() const; 00193 00211 Texture& createTexture(const String& name, Ogre::TexturePtr& tex, 00212 bool take_ownership = false); 00213 00215 void setupRenderingBlendMode(const BlendMode mode, 00216 const bool force = false); 00217 00235 void setFrameControlExecutionEnabled(const bool enabled); 00236 00254 bool isFrameControlExecutionEnabled() const; 00255 00264 void initialiseRenderStateSettings(); 00265 00275 void setDefaultRootRenderTarget(Ogre::RenderTarget& target); 00276 00286 bool isUsingShaders() const; 00287 00306 void setUsingShaders(const bool use_shaders); 00307 00317 void bindShaders(); 00318 00326 void updateShaderParams() const; 00327 00329 void setWorldMatrix(const Ogre::Matrix4& m); 00331 void setViewMatrix(const Ogre::Matrix4& m); 00333 void setProjectionMatrix(const Ogre::Matrix4& m); 00335 const Ogre::Matrix4& getWorldMatrix() const; 00337 const Ogre::Matrix4& getViewMatrix() const; 00339 const Ogre::Matrix4& getProjectionMatrix() const; 00340 00351 const Ogre::Matrix4& getWorldViewProjMatrix() const; 00352 00353 // implement CEGUI::Renderer interface 00354 RenderTarget& getDefaultRenderTarget(); 00355 GeometryBuffer& createGeometryBuffer(); 00356 void destroyGeometryBuffer(const GeometryBuffer& buffer); 00357 void destroyAllGeometryBuffers(); 00358 TextureTarget* createTextureTarget(); 00359 void destroyTextureTarget(TextureTarget* target); 00360 void destroyAllTextureTargets(); 00361 Texture& createTexture(const String& name); 00362 Texture& createTexture(const String& name, 00363 const String& filename, 00364 const String& resourceGroup); 00365 Texture& createTexture(const String& name, const Sizef& size); 00366 void destroyTexture(Texture& texture); 00367 void destroyTexture(const String& name); 00368 void destroyAllTextures(); 00369 Texture& getTexture(const String& name) const; 00370 bool isTextureDefined(const String& name) const; 00371 void beginRendering(); 00372 void endRendering(); 00373 void setDisplaySize(const Sizef& sz); 00374 const Sizef& getDisplaySize() const; 00375 const Vector2f& getDisplayDPI() const; 00376 uint getMaxTextureSize() const; 00377 const String& getIdentifierString() const; 00378 00379 protected: 00381 OgreRenderer(); 00383 OgreRenderer(Ogre::RenderTarget& target); 00385 virtual ~OgreRenderer(); 00386 00388 void checkOgreInitialised(); 00390 void throwIfNameExists(const String& name) const; 00392 static void logTextureCreation(const String& name); 00394 static void logTextureDestruction(const String& name); 00395 00397 void constructor_impl(Ogre::RenderTarget& target); 00399 void initialiseShaders(); 00401 void cleanupShaders(); 00402 00404 OgreRenderer_impl* d_pimpl; 00405 }; 00406 00407 00408 } // End of CEGUI namespace section 00409 00410 #if defined(_MSC_VER) 00411 # pragma warning(pop) 00412 #endif 00413 00414 #endif // end of guard _CEGUIOgreRenderer_h_