00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
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
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
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
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 }
00218
00219 #if defined(_MSC_VER)
00220 # pragma warning(pop)
00221 #endif
00222
00223 #endif // end of guard _CEGUIIrrlichtRenderer_h_