Crazy Eddies GUI System 0.7.6
|
00001 /*********************************************************************** 00002 filename: CEGUIIrrlichtRenderer.h 00003 created: Tue Mar 3 2009 00004 author: Paul D Turner (parts based on original code by Thomas Suter) 00005 *************************************************************************/ 00006 /*************************************************************************** 00007 * Copyright (C) 2004 - 2009 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 _CEGUIIrrlichtRenderer_h_ 00029 #define _CEGUIIrrlichtRenderer_h_ 00030 00031 #include "CEGUIIrrlichtRendererDef.h" 00032 #include "../../CEGUIRenderer.h" 00033 #include "../../CEGUISize.h" 00034 #include "../../CEGUIVector.h" 00035 00036 #include <vector> 00037 00038 #if defined(_MSC_VER) 00039 # pragma warning(push) 00040 # pragma warning(disable : 4251) 00041 #endif 00042 00043 // forward reference irrlicht classes 00044 namespace irr 00045 { 00046 class IrrlichtDevice; 00047 struct SEvent; 00048 00049 namespace video 00050 { 00051 class IVideoDriver; 00052 } 00053 00054 namespace io 00055 { 00056 class IFileSystem; 00057 } 00058 00059 } 00060 00061 // Start of CEGUI namespace section 00062 namespace CEGUI 00063 { 00064 class IrrlichtTexture; 00065 class IrrlichtGeometryBuffer; 00066 class IrrlichtResourceProvider; 00067 class IrrlichtEventPusher; 00068 class IrrlichtImageCodec; 00069 00071 class IRR_GUIRENDERER_API IrrlichtRenderer : public Renderer 00072 { 00073 public: 00092 static IrrlichtRenderer& bootstrapSystem(irr::IrrlichtDevice& device); 00093 00110 static void destroySystem(); 00111 00113 static IrrlichtRenderer& create(irr::IrrlichtDevice& device); 00114 00116 static void destroy(IrrlichtRenderer& renderer); 00117 00119 static IrrlichtResourceProvider& 00120 createIrrlichtResourceProvider(irr::io::IFileSystem& fs); 00121 00123 static void destroyIrrlichtResourceProvider(IrrlichtResourceProvider& rp); 00124 00126 static IrrlichtImageCodec& createIrrlichtImageCodec( 00127 irr::video::IVideoDriver& driver); 00128 00130 static void destroyIrrlichtImageCodec(IrrlichtImageCodec& ic); 00131 00133 bool injectEvent(const irr::SEvent& event); 00134 00145 Size getAdjustedTextureSize(const Size& sz) const; 00146 00152 static float getNextPOTSize(const float f); 00153 00154 // implement Renderer interface 00155 RenderingRoot& getDefaultRenderingRoot(); 00156 GeometryBuffer& createGeometryBuffer(); 00157 void destroyGeometryBuffer(const GeometryBuffer& buffer); 00158 void destroyAllGeometryBuffers(); 00159 TextureTarget* createTextureTarget(); 00160 void destroyTextureTarget(TextureTarget* target); 00161 void destroyAllTextureTargets(); 00162 Texture& createTexture(); 00163 Texture& createTexture(const String& filename, const String& resourceGroup); 00164 Texture& createTexture(const Size& size); 00165 void destroyTexture(Texture& texture); 00166 void destroyAllTextures(); 00167 void beginRendering(); 00168 void endRendering(); 00169 void setDisplaySize(const Size& sz); 00170 const Size& getDisplaySize() const; 00171 const Vector2& getDisplayDPI() const; 00172 uint getMaxTextureSize() const; 00173 const String& getIdentifierString() const; 00174 00175 protected: 00177 IrrlichtRenderer(irr::IrrlichtDevice& device); 00179 ~IrrlichtRenderer(); 00180 00182 static String d_rendererID; 00184 irr::IrrlichtDevice& d_device; 00186 irr::video::IVideoDriver* d_driver; 00188 Size d_displaySize; 00190 Vector2 d_displayDPI; 00192 RenderTarget* d_defaultTarget; 00194 RenderingRoot* d_defaultRoot; 00196 typedef std::vector<TextureTarget*> TextureTargetList; 00198 TextureTargetList d_textureTargets; 00200 typedef std::vector<IrrlichtGeometryBuffer*> GeometryBufferList; 00202 GeometryBufferList d_geometryBuffers; 00204 typedef std::vector<IrrlichtTexture*> TextureList; 00206 TextureList d_textures; 00208 uint d_maxTextureSize; 00210 IrrlichtEventPusher* d_eventPusher; 00212 bool d_supportsNSquareTextures; 00214 bool d_supportsNPOTTextures; 00215 }; 00216 00217 } // End of CEGUI namespace section 00218 00219 #if defined(_MSC_VER) 00220 # pragma warning(pop) 00221 #endif 00222 00223 #endif // end of guard _CEGUIIrrlichtRenderer_h_