Crazy Eddies GUI System  0.7.9
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
CEGUIIrrlichtRenderer.h
1 /***********************************************************************
2  filename: CEGUIIrrlichtRenderer.h
3  created: Tue Mar 3 2009
4  author: Paul D Turner (parts based on original code by Thomas Suter)
5 *************************************************************************/
6 /***************************************************************************
7  * Copyright (C) 2004 - 2009 Paul D Turner & The CEGUI Development Team
8  *
9  * Permission is hereby granted, free of charge, to any person obtaining
10  * a copy of this software and associated documentation files (the
11  * "Software"), to deal in the Software without restriction, including
12  * without limitation the rights to use, copy, modify, merge, publish,
13  * distribute, sublicense, and/or sell copies of the Software, and to
14  * permit persons to whom the Software is furnished to do so, subject to
15  * the following conditions:
16  *
17  * The above copyright notice and this permission notice shall be
18  * included in all copies or substantial portions of the Software.
19  *
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
24  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26  * OTHER DEALINGS IN THE SOFTWARE.
27  ***************************************************************************/
28 #ifndef _CEGUIIrrlichtRenderer_h_
29 #define _CEGUIIrrlichtRenderer_h_
30 
31 #include "CEGUIIrrlichtRendererDef.h"
32 #include "../../CEGUIRenderer.h"
33 #include "../../CEGUISize.h"
34 #include "../../CEGUIVector.h"
35 
36 #include <vector>
37 
38 #if defined(_MSC_VER)
39 # pragma warning(push)
40 # pragma warning(disable : 4251)
41 #endif
42 
43 // forward reference irrlicht classes
44 namespace irr
45 {
46 class IrrlichtDevice;
47 struct SEvent;
48 
49 namespace video
50 {
51 class IVideoDriver;
52 }
53 
54 namespace io
55 {
56 class IFileSystem;
57 }
58 
59 }
60 
61 // Start of CEGUI namespace section
62 namespace CEGUI
63 {
64 class IrrlichtTexture;
65 class IrrlichtGeometryBuffer;
66 class IrrlichtResourceProvider;
67 class IrrlichtEventPusher;
68 class IrrlichtImageCodec;
69 
71 class IRR_GUIRENDERER_API IrrlichtRenderer : public Renderer
72 {
73 public:
92  static IrrlichtRenderer& bootstrapSystem(irr::IrrlichtDevice& device);
93 
110  static void destroySystem();
111 
113  static IrrlichtRenderer& create(irr::IrrlichtDevice& device);
114 
116  static void destroy(IrrlichtRenderer& renderer);
117 
120  createIrrlichtResourceProvider(irr::io::IFileSystem& fs);
121 
123  static void destroyIrrlichtResourceProvider(IrrlichtResourceProvider& rp);
124 
126  static IrrlichtImageCodec& createIrrlichtImageCodec(
127  irr::video::IVideoDriver& driver);
128 
130  static void destroyIrrlichtImageCodec(IrrlichtImageCodec& ic);
131 
133  bool injectEvent(const irr::SEvent& event);
134 
145  Size getAdjustedTextureSize(const Size& sz) const;
146 
152  static float getNextPOTSize(const float f);
153 
154  // implement Renderer interface
155  RenderingRoot& getDefaultRenderingRoot();
156  GeometryBuffer& createGeometryBuffer();
157  void destroyGeometryBuffer(const GeometryBuffer& buffer);
158  void destroyAllGeometryBuffers();
159  TextureTarget* createTextureTarget();
160  void destroyTextureTarget(TextureTarget* target);
161  void destroyAllTextureTargets();
162  Texture& createTexture();
163  Texture& createTexture(const String& filename, const String& resourceGroup);
164  Texture& createTexture(const Size& size);
165  void destroyTexture(Texture& texture);
166  void destroyAllTextures();
167  void beginRendering();
168  void endRendering();
169  void setDisplaySize(const Size& sz);
170  const Size& getDisplaySize() const;
171  const Vector2& getDisplayDPI() const;
172  uint getMaxTextureSize() const;
173  const String& getIdentifierString() const;
174 
175 protected:
177  IrrlichtRenderer(irr::IrrlichtDevice& device);
179  ~IrrlichtRenderer();
180 
184  irr::IrrlichtDevice& d_device;
186  irr::video::IVideoDriver* d_driver;
196  typedef std::vector<TextureTarget*> TextureTargetList;
200  typedef std::vector<IrrlichtGeometryBuffer*> GeometryBufferList;
204  typedef std::vector<IrrlichtTexture*> TextureList;
215 };
216 
217 } // End of CEGUI namespace section
218 
219 #if defined(_MSC_VER)
220 # pragma warning(pop)
221 #endif
222 
223 #endif // end of guard _CEGUIIrrlichtRenderer_h_
RenderingRoot * d_defaultRoot
The default rendering root object.
Definition: CEGUIIrrlichtRenderer.h:194
Class used as a two dimensional vector (aka a Point)
Definition: CEGUIVector.h:45
Size d_displaySize
What the renderer considers to be the current display size.
Definition: CEGUIIrrlichtRenderer.h:188
TextureTargetList d_textureTargets
Container used to track texture targets.
Definition: CEGUIIrrlichtRenderer.h:198
Definition: CEGUIIrrlichtEventPusher.h:38
Abstract class defining the interface for objects that buffer geometry for later rendering.
Definition: CEGUIGeometryBuffer.h:42
TextureList d_textures
Container used to track textures.
Definition: CEGUIIrrlichtRenderer.h:206
Class that holds the size (width &amp; height) of something.
Definition: CEGUISize.h:43
Specialisation of RenderTarget interface that should be used as the base class for RenderTargets that...
Definition: CEGUITextureTarget.h:41
bool d_supportsNSquareTextures
true if driver supports non square textures
Definition: CEGUIIrrlichtRenderer.h:212
Vector2 d_displayDPI
What the renderer considers to be the current display DPI resolution.
Definition: CEGUIIrrlichtRenderer.h:190
irr::IrrlichtDevice & d_device
The IrrlichtDevide that we&#39;ll be using.
Definition: CEGUIIrrlichtRenderer.h:184
std::vector< IrrlichtGeometryBuffer * > GeometryBufferList
container type used to hold GeometryBuffers we create.
Definition: CEGUIIrrlichtRenderer.h:200
Abstract base class specifying the required interface for Texture objects.
Definition: CEGUITexture.h:50
Abstract class defining the basic required interface for Renderer objects.
Definition: CEGUIRenderer.h:80
Definition: CEGUIRenderingRoot.h:36
Definition: CEGUIIrrlichtResourceProvider.h:40
std::vector< TextureTarget * > TextureTargetList
container type used to hold TextureTargets we create.
Definition: CEGUIIrrlichtRenderer.h:196
CEGUI::Renderer implementation for the Irrlicht engine.
Definition: CEGUIIrrlichtRenderer.h:71
std::vector< IrrlichtTexture * > TextureList
container type used to hold Textures we create.
Definition: CEGUIIrrlichtRenderer.h:204
uint d_maxTextureSize
What the renderer thinks the max texture size is.
Definition: CEGUIIrrlichtRenderer.h:208
Defines interface to some surface that can be rendered to. Concrete instances of objects that impleme...
Definition: CEGUIRenderTarget.h:42
GeometryBufferList d_geometryBuffers
Container used to track geometry buffers.
Definition: CEGUIIrrlichtRenderer.h:202
ImageCodec object that loads data via image loading facilities in Irrlicht.
Definition: CEGUIIrrlichtImageCodec.h:47
static String d_rendererID
String holding the renderer identification text.
Definition: CEGUIIrrlichtRenderer.h:182
IrrlichtEventPusher * d_eventPusher
ptr to helper object that aids in injection of events from Irrlicht.
Definition: CEGUIIrrlichtRenderer.h:210
RenderTarget * d_defaultTarget
The default RenderTarget (used by d_defaultRoot)
Definition: CEGUIIrrlichtRenderer.h:192
bool d_supportsNPOTTextures
true if driver supports non power of two textures
Definition: CEGUIIrrlichtRenderer.h:214
irr::video::IVideoDriver * d_driver
Irrlicht video driver (as obtained from the device)
Definition: CEGUIIrrlichtRenderer.h:186
String class used within the GUI system.
Definition: CEGUIString.h:57