CEGUI::OgreCEGUIRenderer Class Reference

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

#include <src/ogreceguirenderer/OgreCEGUIRenderer.h>

List of all members.

Public Member Functions

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)
Texture * createTexture (Ogre::TexturePtr &texture)
 Create a texture from an existing Ogre::TexturePtr object.
virtual Texture * createTexture (float size)
virtual Texture * createTexture (const String &filename, const String &resourceGroup="General")
virtual Texture * createTexture (void)
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.
virtual uint getHorzScreenDPI (void) const
 Return the horizontal display resolution dpi.
virtual uint getMaxTextureSize (void) const
 Return the maximum texture size available.
virtual Rect getRect (void) const
 Return a Rect describing the screen.
virtual Size getSize (void) const
 Return the size of the display in pixels.
virtual uint getVertScreenDPI (void) const
 Return the vertical display resolution dpi.
virtual float getWidth (void) const
 Return the current width of the display in pixels.
virtual bool isQueueingEnabled (void) const
 Return whether queueing is enabled.
 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.
 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.
void setDisplaySize (const Size &sz)
 Set the size of the display in pixels.
virtual void setQueueingEnabled (bool setting)
 Enable or disable the queueing of quads from this point on.
void setTargetRenderQueue (Ogre::uint8 queue_id, bool post_queue)
 Set the target render queue for GUI rendering.
void setTargetSceneManager (Ogre::SceneManager *scene_manager)
 Set the scene manager to be used for rendering the GUI.
virtual ~OgreCEGUIRenderer (void)
 Destructor for Ogre renderer.

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

Static Private Attributes

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

Classes

struct  QuadInfo
 structure holding details about a quad to be drawn More...
struct  QuadVertex
 structure used for all vertices. 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:
window Pointer to an Ogre::RenderWindow object.
queue_id Ogre::uint8 value that specifies where the GUI should appear in the ogre rendering output.
post_queue set to true to have GUI rendered after render queue queue_id, or false to have the GUI rendered before render queue queue_id.
max_quads Obsolete. Set to 0.

References constructor_impl().

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:
window Pointer to an Ogre::RenderWindow object.
queue_id Ogre::uint8 value that specifies where the GUI should appear in the ogre rendering output.
post_queue set to true to have GUI rendered after render queue queue_id, or false to have the GUI rendered before render queue queue_id.
max_quads Obsolete. Set to 0.
scene_manager Pointer to an Ogre::SceneManager object that is to be used for GUI rendering.

References constructor_impl(), and setTargetSceneManager().

CEGUI::OgreCEGUIRenderer::~OgreCEGUIRenderer ( void   )  [virtual]


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]

References d_quadlist, and d_sorted.

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 ( 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:
texture pointer 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.

References createTexture(), and CEGUI::OgreCEGUITexture::setOgreTexture().

Texture * CEGUI::OgreCEGUIRenderer::createTexture ( float  size  )  [virtual]

Texture * CEGUI::OgreCEGUIRenderer::createTexture ( const String &  filename,
const String &  resourceGroup = "General" 
) [virtual]

Texture * CEGUI::OgreCEGUIRenderer::createTexture ( void   )  [virtual]

References d_texturelist.

Referenced by createTexture().

void CEGUI::OgreCEGUIRenderer::destroyAllTextures ( void   )  [virtual]

References d_texturelist, and destroyTexture().

Referenced by ~OgreCEGUIRenderer().

void CEGUI::OgreCEGUIRenderer::destroyTexture ( Texture *  texture  )  [virtual]

References d_texturelist.

Referenced by destroyAllTextures().

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

References CEGUI::OgreCEGUIRenderer::QuadInfo::bottomLeftCol, CEGUI::OgreCEGUIRenderer::QuadInfo::bottomRightCol, CEGUI::createQuadRenderOp(), d_buffer, d_bufferPos, d_currTexture, d_quadlist, d_render_op, d_render_sys, d_sorted, d_underused_framecount, CEGUI::destroyQuadRenderOp(), CEGUI::OgreCEGUIRenderer::QuadVertex::diffuse, initRenderStates(), CEGUI::OgreCEGUIRenderer::QuadInfo::position, sortQuads(), CEGUI::OgreCEGUIRenderer::QuadInfo::splitMode, CEGUI::OgreCEGUIRenderer::QuadInfo::texPosition, CEGUI::OgreCEGUIRenderer::QuadInfo::texture, CEGUI::OgreCEGUIRenderer::QuadInfo::topLeftCol, CEGUI::OgreCEGUIRenderer::QuadInfo::topRightCol, CEGUI::OgreCEGUIRenderer::QuadVertex::tu1, CEGUI::OgreCEGUIRenderer::QuadVertex::tv1, UNDERUSED_FRAME_THRESHOLD, VERTEX_PER_QUAD, CEGUI::OgreCEGUIRenderer::QuadVertex::x, CEGUI::OgreCEGUIRenderer::QuadVertex::y, CEGUI::OgreCEGUIRenderer::QuadInfo::z, and CEGUI::OgreCEGUIRenderer::QuadVertex::z.

virtual float CEGUI::OgreCEGUIRenderer::getHeight ( void   )  const [inline, virtual]

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 [inline, virtual]

Return the horizontal display resolution dpi.

Returns:
horizontal resolution of the display in dpi.

virtual uint CEGUI::OgreCEGUIRenderer::getMaxTextureSize ( void   )  const [inline, virtual]

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 [inline, virtual]

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 [inline, virtual]

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 [inline, virtual]

Return the vertical display resolution dpi.

Returns:
vertical resolution of the display in dpi.

virtual float CEGUI::OgreCEGUIRenderer::getWidth ( void   )  const [inline, virtual]

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 [inline, virtual]

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:
sz Size object describing the size of the display.
Returns:
Nothing.

References d_display_area.

virtual void CEGUI::OgreCEGUIRenderer::setQueueingEnabled ( bool  setting  )  [inline, virtual]

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:
setting true 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_id Ogre::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.

References d_ourlistener, d_post_queue, d_queue_id, CEGUI::CEGUIRQListener::setPostRenderQueue(), and CEGUI::CEGUIRQListener::setTargetRenderQueue().

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_manager Pointer to an Ogre::SceneManager object that is the new target Ogre::SceneManager to be used for GUI rendering.
Returns:
Nothing.

References d_ourlistener, and d_sceneMngr.

Referenced by OgreCEGUIRenderer(), orxonox::GUIManager::setCamera(), and ~OgreCEGUIRenderer().

void CEGUI::OgreCEGUIRenderer::sortQuads ( void   )  [private]

References d_sorted.

Referenced by doRender().


Member Data Documentation

Ogre::LayerBlendModeEx CEGUI::OgreCEGUIRenderer::d_alphaBlendMode [private]

Controls alpha blending mode used.

Referenced by constructor_impl(), and initRenderStates().

Ogre::HardwareVertexBufferSharedPtr CEGUI::OgreCEGUIRenderer::d_buffer [private]

vertex buffer to queue sprite rendering

Referenced by constructor_impl(), doRender(), and ~OgreCEGUIRenderer().

index into buffer where next vertex should be put.

Referenced by constructor_impl(), and doRender().

Ogre::LayerBlendModeEx CEGUI::OgreCEGUIRenderer::d_colourBlendMode [private]

Controls colour blending mode used.

Referenced by constructor_impl(), and initRenderStates().

Ogre::TexturePtr CEGUI::OgreCEGUIRenderer::d_currTexture [private]

currently set texture;

Referenced by constructor_impl(), and doRender().

Ogre::HardwareVertexBufferSharedPtr CEGUI::OgreCEGUIRenderer::d_direct_buffer [private]

Renderop for cursor.

Referenced by constructor_impl(), renderQuadDirect(), and ~OgreCEGUIRenderer().

Ogre::RenderOperation CEGUI::OgreCEGUIRenderer::d_direct_render_op [private]

Renderop for cursor.

Referenced by constructor_impl(), renderQuadDirect(), and ~OgreCEGUIRenderer().

pointer to the Ogre root object that we attach to

Referenced by constructor_impl().

true if we render after everything else in our queue.

Referenced by constructor_impl(), and setTargetRenderQueue().

Referenced by addQuad(), clearRenderList(), and doRender().

Ogre::uint8 CEGUI::OgreCEGUIRenderer::d_queue_id [private]

ID of the queue that we are hooked into.

Referenced by constructor_impl(), and setTargetRenderQueue().

setting for queueing control.

Referenced by addQuad(), and constructor_impl().

Ogre::RenderOperation CEGUI::OgreCEGUIRenderer::d_render_op [private]

Ogre render operation we use to do our stuff.

Referenced by constructor_impl(), doRender(), and ~OgreCEGUIRenderer().

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

Pointer to the render system for Ogre.

Referenced by colourToOgre(), constructor_impl(), doRender(), initRenderStates(), and renderQuadDirect().

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

The scene manager we are hooked into.

Referenced by constructor_impl(), and setTargetSceneManager().

true when data in quad list is sorted.

Referenced by addQuad(), clearRenderList(), constructor_impl(), doRender(), and sortQuads().

Offset required for proper texel mapping.

Referenced by addQuad(), constructor_impl(), and renderQuadDirect().

List used to track textures.

Referenced by createTexture(), destroyAllTextures(), and destroyTexture().

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

Referenced by constructor_impl(), and doRender().

Ogre::TextureUnitState::UVWAddressingMode CEGUI::OgreCEGUIRenderer::d_uvwAddressMode [private]

const size_t CEGUI::OgreCEGUIRenderer::UNDERUSED_FRAME_THRESHOLD = 50000 [static, private]

number of frames to wait before shrinking buffer

Referenced by doRender().

const size_t CEGUI::OgreCEGUIRenderer::VERTEX_PER_QUAD = 6 [static, private]

number of vertices per quad

Referenced by constructor_impl(), doRender(), and renderQuadDirect().

const size_t CEGUI::OgreCEGUIRenderer::VERTEX_PER_TRIANGLE = 3 [static, private]

number of vertices for a triangle

const size_t CEGUI::OgreCEGUIRenderer::VERTEXBUFFER_INITIAL_CAPACITY = 256 [static, private]

initial capacity of the allocated vertex buffer

Referenced by constructor_impl().


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

Generated on Tue Jul 28 16:22:16 2009 for Orxonox by  doxygen 1.5.6