Orxonox  0.0.5 Codename: Arcturus
Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
CEGUI::OgreCEGUIRenderer Class Reference

Renderer class to interface with Ogre engine. More...

#include </home/jenkins/workspace/orxonox_doxygen_trunk/src/external/ogreceguirenderer/OgreCEGUIRenderer.h>

Inheritance diagram for CEGUI::OgreCEGUIRenderer:

Classes

struct  QuadInfo
 structure holding details about a quad to be drawn More...
 
struct  QuadVertex
 structure used for all vertices. More...
 

Public Member Functions

 OgreCEGUIRenderer (Ogre::RenderWindow *window, Ogre::uint8 queue_id=Ogre::RENDER_QUEUE_OVERLAY, bool post_queue=false, uint max_quads=0)
 Constructor for renderer class that uses Ogre for rendering. Note that if you use this option you must call setTargetSceneManager before rendering. More...
 
 OgreCEGUIRenderer (Ogre::RenderWindow *window, Ogre::uint8 queue_id, bool post_queue, uint max_quads, Ogre::SceneManager *scene_manager)
 Constructor for renderer class that uses Ogre for rendering. More...
 
virtual ~OgreCEGUIRenderer (void)
 Destructor for Ogre renderer. More...
 
virtual void addQuad (const Rect &dest_rect, float z, const Texture *tex, const Rect &texture_rect, const ColourRect &colours, QuadSplitMode quad_split_mode)
 
virtual void clearRenderList (void)
 
virtual ResourceProvider * createResourceProvider (void)
 
virtual Texture * createTexture (void)
 
virtual Texture * createTexture (const String &filename, const String &resourceGroup="General")
 
virtual Texture * createTexture (float size)
 
Texture * createTexture (Ogre::TexturePtr &texture)
 Create a texture from an existing Ogre::TexturePtr object. More...
 
virtual void destroyAllTextures (void)
 
virtual void destroyTexture (Texture *texture)
 
virtual void doRender (void)
 
virtual float getHeight (void) const
 Return the current height of the display in pixels. More...
 
virtual uint getHorzScreenDPI (void) const
 Return the horizontal display resolution dpi. More...
 
virtual uint getMaxTextureSize (void) const
 Return the maximum texture size available. More...
 
virtual Rect getRect (void) const
 Return a Rect describing the screen. More...
 
virtual Size getSize (void) const
 Return the size of the display in pixels. More...
 
virtual uint getVertScreenDPI (void) const
 Return the vertical display resolution dpi. More...
 
virtual float getWidth (void) const
 Return the current width of the display in pixels. More...
 
virtual bool isQueueingEnabled (void) const
 Return whether queueing is enabled. More...
 
void setDisplaySize (const Size &sz)
 Set the size of the display in pixels. More...
 
virtual void setQueueingEnabled (bool setting)
 Enable or disable the queueing of quads from this point on. More...
 
void setTargetRenderQueue (Ogre::uint8 queue_id, bool post_queue)
 Set the target render queue for GUI rendering. More...
 
void setTargetSceneManager (Ogre::SceneManager *scene_manager)
 Set the scene manager to be used for rendering the GUI. More...
 

Private Types

typedef std::multiset< QuadInfoQuadList
 

Private Member Functions

uint32 colourToOgre (const colour &col) const
 
void constructor_impl (Ogre::RenderWindow *window, Ogre::uint8 queue_id, bool post_queue, uint max_quads)
 
void initRenderStates (void)
 
void renderQuadDirect (const Rect &dest_rect, float z, const Texture *tex, const Rect &texture_rect, const ColourRect &colours, QuadSplitMode quad_split_mode)
 
void sortQuads (void)
 

Private Attributes

Ogre::LayerBlendModeEx d_alphaBlendMode
 Controls alpha blending mode used. More...
 
Ogre::HardwareVertexBufferSharedPtr d_buffer
 vertex buffer to queue sprite rendering More...
 
size_t d_bufferPos
 index into buffer where next vertex should be put. More...
 
Ogre::LayerBlendModeEx d_colourBlendMode
 Controls colour blending mode used. More...
 
Ogre::TexturePtr d_currTexture
 currently set texture; More...
 
Ogre::HardwareVertexBufferSharedPtr d_direct_buffer
 Renderop for cursor. More...
 
Ogre::RenderOperation d_direct_render_op
 Renderop for cursor. More...
 
Rect d_display_area
 
Ogre::Root * d_ogre_root
 pointer to the Ogre root object that we attach to More...
 
CEGUIRQListenerd_ourlistener
 
bool d_post_queue
 true if we render after everything else in our queue. More...
 
QuadList d_quadlist
 
Ogre::uint8 d_queue_id
 ID of the queue that we are hooked into. More...
 
bool d_queueing
 setting for queueing control. More...
 
Ogre::RenderOperation d_render_op
 Ogre render operation we use to do our stuff. More...
 
Ogre::RenderSystem * d_render_sys
 Pointer to the render system for Ogre. More...
 
Ogre::SceneManager * d_sceneMngr
 The scene manager we are hooked into. More...
 
bool d_sorted
 true when data in quad list is sorted. More...
 
Point d_texelOffset
 Offset required for proper texel mapping. More...
 
std::list< OgreCEGUITexture * > d_texturelist
 List used to track textures. More...
 
size_t d_underused_framecount
 Number of frames elapsed since buffer utilization was above half the capacity. More...
 
Ogre::TextureUnitState::UVWAddressingMode d_uvwAddressMode
 

Static Private Attributes

static const size_t UNDERUSED_FRAME_THRESHOLD = 50000
 number of frames to wait before shrinking buffer More...
 
static const size_t VERTEX_PER_QUAD = 6
 number of vertices per quad More...
 
static const size_t VERTEX_PER_TRIANGLE = 3
 number of vertices for a triangle More...
 
static const size_t VERTEXBUFFER_INITIAL_CAPACITY = 256
 initial capacity of the allocated vertex buffer More...
 

Detailed Description

Renderer class to interface with Ogre engine.

Member Typedef Documentation

typedef std::multiset<QuadInfo> CEGUI::OgreCEGUIRenderer::QuadList
private

Constructor & Destructor Documentation

CEGUI::OgreCEGUIRenderer::OgreCEGUIRenderer ( Ogre::RenderWindow *  window,
Ogre::uint8  queue_id = Ogre::RENDER_QUEUE_OVERLAY,
bool  post_queue = false,
uint  max_quads = 0 
)

Constructor for renderer class that uses Ogre for rendering. Note that if you use this option you must call setTargetSceneManager before rendering.

Parameters
windowPointer to an Ogre::RenderWindow object.
queue_idOgre::uint8 value that specifies where the GUI should appear in the ogre rendering output.
post_queueset to true to have GUI rendered after render queue queue_id, or false to have the GUI rendered before render queue queue_id.
max_quadsObsolete. Set to 0.
CEGUI::OgreCEGUIRenderer::OgreCEGUIRenderer ( Ogre::RenderWindow *  window,
Ogre::uint8  queue_id,
bool  post_queue,
uint  max_quads,
Ogre::SceneManager *  scene_manager 
)

Constructor for renderer class that uses Ogre for rendering.

Parameters
windowPointer to an Ogre::RenderWindow object.
queue_idOgre::uint8 value that specifies where the GUI should appear in the ogre rendering output.
post_queueset to true to have GUI rendered after render queue queue_id, or false to have the GUI rendered before render queue queue_id.
max_quadsObsolete. Set to 0.
scene_managerPointer to an Ogre::SceneManager object that is to be used for GUI rendering.
CEGUI::OgreCEGUIRenderer::~OgreCEGUIRenderer ( void  )
virtual

Destructor for Ogre renderer.

Member Function Documentation

void CEGUI::OgreCEGUIRenderer::addQuad ( const Rect &  dest_rect,
float  z,
const Texture *  tex,
const Rect &  texture_rect,
const ColourRect &  colours,
QuadSplitMode  quad_split_mode 
)
virtual
void CEGUI::OgreCEGUIRenderer::clearRenderList ( void  )
virtual
uint32 CEGUI::OgreCEGUIRenderer::colourToOgre ( const colour &  col) const
private
void CEGUI::OgreCEGUIRenderer::constructor_impl ( Ogre::RenderWindow *  window,
Ogre::uint8  queue_id,
bool  post_queue,
uint  max_quads 
)
private
ResourceProvider * CEGUI::OgreCEGUIRenderer::createResourceProvider ( void  )
virtual
Texture * CEGUI::OgreCEGUIRenderer::createTexture ( void  )
virtual
Texture * CEGUI::OgreCEGUIRenderer::createTexture ( const String &  filename,
const String &  resourceGroup = "General" 
)
virtual
Texture * CEGUI::OgreCEGUIRenderer::createTexture ( float  size)
virtual
Texture * CEGUI::OgreCEGUIRenderer::createTexture ( Ogre::TexturePtr &  texture)

Create a texture from an existing Ogre::TexturePtr object.

Note
If you want to use an Ogre::RenderTexture (for putting rendered output onto Gui elements or other advanced techniques), you can get the Ogre::TexturePtr to be used by calling Ogre::TextureManager::getByName() passing the name returned from Ogre::RenderTexture::getName() (and casting the result as necessary).
Parameters
texturepointer to an Ogre::TexturePtr object to be used as the basis for the new CEGUI::Texture
Returns
Pointer to the newly created CEGUI::TexturePtr object.
void CEGUI::OgreCEGUIRenderer::destroyAllTextures ( void  )
virtual
void CEGUI::OgreCEGUIRenderer::destroyTexture ( Texture *  texture)
virtual
void CEGUI::OgreCEGUIRenderer::doRender ( void  )
virtual

Quad list needs to be sorted and thus the vertex buffer rebuilt. If not, we can reuse the vertex buffer resulting in a nice speed gain.

Resize vertex buffer if it is too small

Double buffer size until smaller than requested size

Reallocate the buffer

Resize vertex buffer if it has been to big for too long

Reset underused framecount so it takes another UNDERUSED_FRAME_THRESHOLD to half again

Fill the buffer

Render the buffer

If it has a different texture, render this quad in next operation also need to reset render states

Set texture, and do the render

Count frames to check if utilization of vertex buffer was below half the capacity for 500,000 frames

virtual float CEGUI::OgreCEGUIRenderer::getHeight ( void  ) const
inlinevirtual

Return the current height of the display in pixels.

Returns
float value equal to the current height of the display in pixels.
virtual uint CEGUI::OgreCEGUIRenderer::getHorzScreenDPI ( void  ) const
inlinevirtual

Return the horizontal display resolution dpi.

Returns
horizontal resolution of the display in dpi.
virtual uint CEGUI::OgreCEGUIRenderer::getMaxTextureSize ( void  ) const
inlinevirtual

Return the maximum texture size available.

Returns
Size of the maximum supported texture in pixels (textures are always assumed to be square)
virtual Rect CEGUI::OgreCEGUIRenderer::getRect ( void  ) const
inlinevirtual

Return a Rect describing the screen.

Returns
A Rect object that describes the screen area. Typically, the top-left values are always 0, and the size of the area described is equal to the screen resolution.
virtual Size CEGUI::OgreCEGUIRenderer::getSize ( void  ) const
inlinevirtual

Return the size of the display in pixels.

Returns
Size object describing the dimensions of the current display.
virtual uint CEGUI::OgreCEGUIRenderer::getVertScreenDPI ( void  ) const
inlinevirtual

Return the vertical display resolution dpi.

Returns
vertical resolution of the display in dpi.
virtual float CEGUI::OgreCEGUIRenderer::getWidth ( void  ) const
inlinevirtual

Return the current width of the display in pixels.

Returns
float value equal to the current width of the display in pixels.
void CEGUI::OgreCEGUIRenderer::initRenderStates ( void  )
private
virtual bool CEGUI::OgreCEGUIRenderer::isQueueingEnabled ( void  ) const
inlinevirtual

Return whether queueing is enabled.

Returns
true if queueing is enabled, false if queueing is disabled.
void CEGUI::OgreCEGUIRenderer::renderQuadDirect ( const Rect &  dest_rect,
float  z,
const Texture *  tex,
const Rect &  texture_rect,
const ColourRect &  colours,
QuadSplitMode  quad_split_mode 
)
private
void CEGUI::OgreCEGUIRenderer::setDisplaySize ( const Size &  sz)

Set the size of the display in pixels.

You do not have to call this method under normal operation as the system will automatically extract the size from the current view port.

Note
This method will cause the EventDisplaySizeChanged event to fire if the display size has changed.
Parameters
szSize object describing the size of the display.
Returns
Nothing.
virtual void CEGUI::OgreCEGUIRenderer::setQueueingEnabled ( bool  setting)
inlinevirtual

Enable or disable the queueing of quads from this point on.

This only affects queueing. If queueing is turned off, any calls to addQuad will cause the quad to be rendered directly. Note that disabling queueing will not cause currently queued quads to be rendered, nor is the queue cleared - at any time the queue can still be drawn by calling doRender, and the list can be cleared by calling clearRenderList. Re-enabling the queue causes subsequent quads to be added as if queueing had never been disabled.

Parameters
settingtrue to enable queueing, or false to disable queueing (see notes above).
Returns
Nothing
void CEGUI::OgreCEGUIRenderer::setTargetRenderQueue ( Ogre::uint8  queue_id,
bool  post_queue 
)

Set the target render queue for GUI rendering.

Parameters
queue_idOgre::uint8 value specifying the render queue that the GUI system should attach to.
post_queue
  • true to specify that the GUI should render after everything else in render queue queue_id.
  • false to specify the GUI should render before everything else in render queue queue_id.
Returns
Nothing.
void CEGUI::OgreCEGUIRenderer::setTargetSceneManager ( Ogre::SceneManager *  scene_manager)

Set the scene manager to be used for rendering the GUI.

The GUI system will be unhooked from the current scene manager and attached to what ever is specified here.

Parameters
scene_managerPointer to an Ogre::SceneManager object that is the new target Ogre::SceneManager to be used for GUI rendering.
Returns
Nothing.
void CEGUI::OgreCEGUIRenderer::sortQuads ( void  )
private

Member Data Documentation

Ogre::LayerBlendModeEx CEGUI::OgreCEGUIRenderer::d_alphaBlendMode
private

Controls alpha blending mode used.

Ogre::HardwareVertexBufferSharedPtr CEGUI::OgreCEGUIRenderer::d_buffer
private

vertex buffer to queue sprite rendering

size_t CEGUI::OgreCEGUIRenderer::d_bufferPos
private

index into buffer where next vertex should be put.

Ogre::LayerBlendModeEx CEGUI::OgreCEGUIRenderer::d_colourBlendMode
private

Controls colour blending mode used.

Ogre::TexturePtr CEGUI::OgreCEGUIRenderer::d_currTexture
private

currently set texture;

Ogre::HardwareVertexBufferSharedPtr CEGUI::OgreCEGUIRenderer::d_direct_buffer
private

Renderop for cursor.

Ogre::RenderOperation CEGUI::OgreCEGUIRenderer::d_direct_render_op
private

Renderop for cursor.

Rect CEGUI::OgreCEGUIRenderer::d_display_area
private
Ogre::Root* CEGUI::OgreCEGUIRenderer::d_ogre_root
private

pointer to the Ogre root object that we attach to

CEGUIRQListener* CEGUI::OgreCEGUIRenderer::d_ourlistener
private
bool CEGUI::OgreCEGUIRenderer::d_post_queue
private

true if we render after everything else in our queue.

QuadList CEGUI::OgreCEGUIRenderer::d_quadlist
private
Ogre::uint8 CEGUI::OgreCEGUIRenderer::d_queue_id
private

ID of the queue that we are hooked into.

bool CEGUI::OgreCEGUIRenderer::d_queueing
private

setting for queueing control.

Ogre::RenderOperation CEGUI::OgreCEGUIRenderer::d_render_op
private

Ogre render operation we use to do our stuff.

Ogre::RenderSystem* CEGUI::OgreCEGUIRenderer::d_render_sys
private

Pointer to the render system for Ogre.

Ogre::SceneManager* CEGUI::OgreCEGUIRenderer::d_sceneMngr
private

The scene manager we are hooked into.

bool CEGUI::OgreCEGUIRenderer::d_sorted
private

true when data in quad list is sorted.

Point CEGUI::OgreCEGUIRenderer::d_texelOffset
private

Offset required for proper texel mapping.

std::list<OgreCEGUITexture*> CEGUI::OgreCEGUIRenderer::d_texturelist
private

List used to track textures.

size_t CEGUI::OgreCEGUIRenderer::d_underused_framecount
private

Number of frames elapsed since buffer utilization was above half the capacity.

Ogre::TextureUnitState::UVWAddressingMode CEGUI::OgreCEGUIRenderer::d_uvwAddressMode
private
const size_t CEGUI::OgreCEGUIRenderer::UNDERUSED_FRAME_THRESHOLD = 50000
staticprivate

number of frames to wait before shrinking buffer

const size_t CEGUI::OgreCEGUIRenderer::VERTEX_PER_QUAD = 6
staticprivate

number of vertices per quad

const size_t CEGUI::OgreCEGUIRenderer::VERTEX_PER_TRIANGLE = 3
staticprivate

number of vertices for a triangle

const size_t CEGUI::OgreCEGUIRenderer::VERTEXBUFFER_INITIAL_CAPACITY = 256
staticprivate

initial capacity of the allocated vertex buffer


The documentation for this class was generated from the following files: