Crazy Eddie's GUI System  0.8.4
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
CEGUI::OgreRenderer Class Reference

CEGUI::Renderer implementation for the Ogre engine. More...

+ Inheritance diagram for CEGUI::OgreRenderer:
+ Collaboration diagram for CEGUI::OgreRenderer:

Public Member Functions

void setRenderingEnabled (const bool enabled)
 set whether CEGUI rendering will occur
 
bool isRenderingEnabled () const
 return whether CEGUI rendering is enabled.
 
TexturecreateTexture (const String &name, Ogre::TexturePtr &tex, bool take_ownership=false)
 Create a CEGUI::Texture that wraps an existing Ogre texture. More...
 
void setupRenderingBlendMode (const BlendMode mode, const bool force=false)
 set the render states for the specified BlendMode.
 
void setFrameControlExecutionEnabled (const bool enabled)
 Controls whether rendering done by CEGUI will be wrapped with calls to Ogre::RenderSystem::_beginFrame and Ogre::RenderSystem::_endFrame. More...
 
bool isFrameControlExecutionEnabled () const
 Returns whether rendering done by CEGUI will be wrapped with calls to Ogre::RenderSystem::_beginFrame and Ogre::RenderSystem::_endFrame. More...
 
void initialiseRenderStateSettings ()
 Sets all the required render states needed for CEGUI rendering. More...
 
void setDefaultRootRenderTarget (Ogre::RenderTarget &target)
 Sets the Ogre::RenderTarget that should be targetted by the default GUIContext. More...
 
bool isUsingShaders () const
 Returns whether the OgreRenderer is currently set to use shaders when doing its rendering operations. More...
 
void setUsingShaders (const bool use_shaders)
 Set whether the OgreRenderer shound use shaders when performing its rendering operations. More...
 
void bindShaders ()
 Perform required operations to bind shaders (or unbind them) depending on whether shader based rendering is currently enabled. More...
 
void updateShaderParams () const
 Updates the shader constant parameters (i.e. uniforms). More...
 
void setWorldMatrix (const Ogre::Matrix4 &m)
 Set the current world matrix to the given matrix.
 
void setViewMatrix (const Ogre::Matrix4 &m)
 Set the current view matrix to the given matrix.
 
void setProjectionMatrix (const Ogre::Matrix4 &m)
 Set the current projection matrix to the given matrix.
 
const Ogre::Matrix4 & getWorldMatrix () const
 return a const reference to the current world matrix.
 
const Ogre::Matrix4 & getViewMatrix () const
 return a const reference to the current view matrix.
 
const Ogre::Matrix4 & getProjectionMatrix () const
 return a const reference to the current projection matrix.
 
const Ogre::Matrix4 & getWorldViewProjMatrix () const
 Return a const reference to the final transformation matrix that should be used when transforming geometry. More...
 
RenderTargetgetDefaultRenderTarget ()
 Returns the default RenderTarget object. The default render target is is typically one that targets the entire screen (or rendering window). More...
 
GeometryBuffercreateGeometryBuffer ()
 Create a new GeometryBuffer and return a reference to it. You should remove the GeometryBuffer from any RenderQueues and call destroyGeometryBuffer when you want to destroy the GeometryBuffer. More...
 
void destroyGeometryBuffer (const GeometryBuffer &buffer)
 Destroy a GeometryBuffer that was returned when calling the createGeometryBuffer function. Before destroying any GeometryBuffer you should ensure that it has been removed from any RenderQueue that was using it. More...
 
void destroyAllGeometryBuffers ()
 Destroy all GeometryBuffer objects created by this Renderer.
 
TextureTargetcreateTextureTarget ()
 Create a TextureTarget that can be used to cache imagery; this is a RenderTarget that does not lose it's content from one frame to another. More...
 
void destroyTextureTarget (TextureTarget *target)
 Function that cleans up TextureTarget objects created with the createTextureTarget function. More...
 
void destroyAllTextureTargets ()
 Destory all TextureTarget objects created by this Renderer.
 
TexturecreateTexture (const String &name)
 Create a 'null' Texture object. More...
 
TexturecreateTexture (const String &name, const String &filename, const String &resourceGroup)
 Create a Texture object using the given image file. More...
 
TexturecreateTexture (const String &name, const Sizef &size)
 Create a Texture object with the given pixel dimensions as specified by size. More...
 
void destroyTexture (Texture &texture)
 Destroy a Texture object that was previously created by calling the createTexture functions. More...
 
void destroyTexture (const String &name)
 Destroy a Texture object that was previously created by calling the createTexture functions. More...
 
void destroyAllTextures ()
 Destroy all Texture objects created by this Renderer.
 
TexturegetTexture (const String &name) const
 Return a Texture object that was previously created by calling the createTexture functions. More...
 
bool isTextureDefined (const String &name) const
 Return whether a texture with the given name exists.
 
void beginRendering ()
 Perform any operations required to put the system into a state ready for rendering operations to begin.
 
void endRendering ()
 Perform any operations required to finalise rendering.
 
void setDisplaySize (const Sizef &sz)
 Set the size of the display or host window in pixels for this Renderer object. More...
 
const SizefgetDisplaySize () const
 Return the size of the display or host window in pixels. More...
 
const Vector2fgetDisplayDPI () const
 Return the resolution of the display or host window in dots per inch. More...
 
uint getMaxTextureSize () const
 Return the pixel size of the maximum supported texture. More...
 
const StringgetIdentifierString () const
 Return identification string for the renderer module. More...
 
- Public Member Functions inherited from CEGUI::Renderer
virtual ~Renderer ()
 Destructor.
 

Static Public Member Functions

static OgreRendererbootstrapSystem (const int abi=CEGUI_VERSION_ABI)
 Convenience function that creates all the Ogre specific objects and then initialises the CEGUI system with them. More...
 
static OgreRendererbootstrapSystem (Ogre::RenderTarget &target, const int abi=CEGUI_VERSION_ABI)
 Convenience function that creates all the Ogre specific objects and then initialises the CEGUI system with them. More...
 
static void destroySystem ()
 Convenience function to cleanup the CEGUI system and related objects that were created by calling the bootstrapSystem function. More...
 
static OgreRenderercreate (const int abi=CEGUI_VERSION_ABI)
 Create an OgreRenderer object that uses the default Ogre rendering window as the default output surface. More...
 
static OgreRenderercreate (Ogre::RenderTarget &target, const int abi=CEGUI_VERSION_ABI)
 Create an OgreRenderer object that uses the specified Ogre::RenderTarget as the default output surface.
 
static void destroy (OgreRenderer &renderer)
 destory an OgreRenderer object.
 
static OgreResourceProvidercreateOgreResourceProvider ()
 function to create a CEGUI::OgreResourceProvider object
 
static void destroyOgreResourceProvider (OgreResourceProvider &rp)
 function to destroy a CEGUI::OgreResourceProvider object
 
static OgreImageCodeccreateOgreImageCodec ()
 function to create a CEGUI::OgreImageCodec object.
 
static void destroyOgreImageCodec (OgreImageCodec &ic)
 function to destroy a CEGUI::OgreImageCodec object.
 

Protected Member Functions

 OgreRenderer ()
 default constructor.
 
 OgreRenderer (Ogre::RenderTarget &target)
 constructor takin the Ogre::RenderTarget to use as the default root.
 
virtual ~OgreRenderer ()
 destructor.
 
void checkOgreInitialised ()
 checks Ogre initialisation. throws exceptions if an issue is detected.
 
void throwIfNameExists (const String &name) const
 helper to throw exception if name is already used.
 
void constructor_impl (Ogre::RenderTarget &target)
 common parts of constructor
 
void initialiseShaders ()
 helper that creates and sets up shaders
 
void cleanupShaders ()
 helper to clean up shaders
 

Static Protected Member Functions

static void logTextureCreation (const String &name)
 helper to safely log the creation of a named texture
 
static void logTextureDestruction (const String &name)
 helper to safely log the destruction of a named texture
 

Protected Attributes

OgreRenderer_impl * d_pimpl
 Pointer to the hidden implementation data.
 

Detailed Description

CEGUI::Renderer implementation for the Ogre engine.

Member Function Documentation

void CEGUI::OgreRenderer::bindShaders ( )

Perform required operations to bind shaders (or unbind them) depending on whether shader based rendering is currently enabled.

Normally you would not need to call this function directly, although that might be required if you are using RenderEffect objects that also use shaders.

static OgreRenderer& CEGUI::OgreRenderer::bootstrapSystem ( const int  abi = CEGUI_VERSION_ABI)
static

Convenience function that creates all the Ogre specific objects and then initialises the CEGUI system with them.

The created Renderer will use the default Ogre rendering window as the
default output surface.

This will create and initialise the following objects for you:
- CEGUI::OgreRenderer
- CEGUI::OgreResourceProvider
- CEGUI::OgreImageCodec
- CEGUI::System
Parameters
abiThis must be set to CEGUI_VERSION_ABI
Returns
Reference to the CEGUI::OgreRenderer object that was created.
Note
For this to succeed you must have initialised Ogre to auto create the rendering window. If you have not done this, then you'll be wanting to use the overload that takes an Ogre::RenderTarget as input.
static OgreRenderer& CEGUI::OgreRenderer::bootstrapSystem ( Ogre::RenderTarget &  target,
const int  abi = CEGUI_VERSION_ABI 
)
static

Convenience function that creates all the Ogre specific objects and then initialises the CEGUI system with them.

The create Renderer will use the specified Ogre::RenderTarget as the
default output surface.

This will create and initialise the following objects for you:
- CEGUI::OgreRenderer
- CEGUI::OgreResourceProvider
- CEGUI::OgreImageCodec
- CEGUI::System
Parameters
targetReference to the Ogre::RenderTarget object that the created OgreRenderer will use as the default rendering root.
abiThis must be set to CEGUI_VERSION_ABI
Returns
Reference to the CEGUI::OgreRenderer object that was created.
static OgreRenderer& CEGUI::OgreRenderer::create ( const int  abi = CEGUI_VERSION_ABI)
static

Create an OgreRenderer object that uses the default Ogre rendering window as the default output surface.

Note
For this to succeed you must have initialised Ogre to auto create the rendering window. If you have not done this, then you'll be wanting to use the overload that takes an Ogre::RenderTarget as input.
GeometryBuffer& CEGUI::OgreRenderer::createGeometryBuffer ( )
virtual

Create a new GeometryBuffer and return a reference to it. You should remove the GeometryBuffer from any RenderQueues and call destroyGeometryBuffer when you want to destroy the GeometryBuffer.

Returns
GeometryBuffer object.

Implements CEGUI::Renderer.

Texture& CEGUI::OgreRenderer::createTexture ( const String name,
Ogre::TexturePtr &  tex,
bool  take_ownership = false 
)

Create a CEGUI::Texture that wraps an existing Ogre texture.

Parameters
nameThe name for tne new texture being created.
texOgre::TexturePtr for the texture that will be used by the created CEGUI::Texture.
take_ownership
  • true if the created Texture will assume ownership of tex and thus destroy tex when the Texture is destroyed.
  • false if ownership of tex remains with the client app, and so no attempt will be made to destroy tex when the Texture is destroyed.
Texture& CEGUI::OgreRenderer::createTexture ( const String name)
virtual

Create a 'null' Texture object.

Parameters
nameString holding the name for the new texture. Texture names must be unique within the Renderer.
Returns
A newly created Texture object. The returned Texture object has no size or imagery associated with it.

Implements CEGUI::Renderer.

Texture& CEGUI::OgreRenderer::createTexture ( const String name,
const String filename,
const String resourceGroup 
)
virtual

Create a Texture object using the given image file.

Parameters
nameString holding the name for the new texture. Texture names must be unique within the Renderer.
filenameString object that specifies the path and filename of the image file to use when creating the texture.
resourceGroupString objet that specifies the resource group identifier to be passed to the resource provider when loading the texture file filename.
Returns
A newly created Texture object. The initial content of the texture memory is the requested image file.
Note
Due to possible limitations of the underlying hardware, API or engine, the final size of the texture may not match the size of the loaded file. You can check the ultimate sizes by querying the Texture object after creation.

Implements CEGUI::Renderer.

Texture& CEGUI::OgreRenderer::createTexture ( const String name,
const Sizef size 
)
virtual

Create a Texture object with the given pixel dimensions as specified by size.

Parameters
nameString holding the name for the new texture. Texture names must be unique within the Renderer.
sizeSize object that describes the desired texture size.
Returns
A newly created Texture object. The initial contents of the texture memory is undefined.
Note
Due to possible limitations of the underlying hardware, API or engine, the final size of the texture may not match the requested size. You can check the ultimate sizes by querying the Texture object after creation.

Implements CEGUI::Renderer.

TextureTarget* CEGUI::OgreRenderer::createTextureTarget ( )
virtual

Create a TextureTarget that can be used to cache imagery; this is a RenderTarget that does not lose it's content from one frame to another.

If the renderer is unable to offer such a thing, 0 should be returned.
Returns
Pointer to a TextureTarget object that is suitable for caching imagery, or 0 if the renderer is unable to offer such a thing.

Implements CEGUI::Renderer.

void CEGUI::OgreRenderer::destroyGeometryBuffer ( const GeometryBuffer buffer)
virtual

Destroy a GeometryBuffer that was returned when calling the createGeometryBuffer function. Before destroying any GeometryBuffer you should ensure that it has been removed from any RenderQueue that was using it.

Parameters
bufferThe GeometryBuffer object to be destroyed.

Implements CEGUI::Renderer.

static void CEGUI::OgreRenderer::destroySystem ( )
static

Convenience function to cleanup the CEGUI system and related objects that were created by calling the bootstrapSystem function.

This function will destroy the following objects for you:
- CEGUI::System
- CEGUI::OgreImageCodec
- CEGUI::OgreResourceProvider
- CEGUI::OgreRenderer
Note
If you did not initialise CEGUI by calling the bootstrapSystem function, you should not call this, but rather delete any objects you created manually.
void CEGUI::OgreRenderer::destroyTexture ( Texture texture)
virtual

Destroy a Texture object that was previously created by calling the createTexture functions.

Parameters
textureTexture object to be destroyed.

Implements CEGUI::Renderer.

void CEGUI::OgreRenderer::destroyTexture ( const String name)
virtual

Destroy a Texture object that was previously created by calling the createTexture functions.

Parameters
nameString holding the name of the texture to destroy.

Implements CEGUI::Renderer.

void CEGUI::OgreRenderer::destroyTextureTarget ( TextureTarget target)
virtual

Function that cleans up TextureTarget objects created with the createTextureTarget function.

Parameters
targetA pointer to a TextureTarget object that was previously returned from a call to createTextureTarget.

Implements CEGUI::Renderer.

RenderTarget& CEGUI::OgreRenderer::getDefaultRenderTarget ( )
virtual

Returns the default RenderTarget object. The default render target is is typically one that targets the entire screen (or rendering window).

Returns
Reference to a RenderTarget object.

Implements CEGUI::Renderer.

const Vector2f& CEGUI::OgreRenderer::getDisplayDPI ( ) const
virtual

Return the resolution of the display or host window in dots per inch.

Returns
Vector2 object that describes the resolution of the display or host window in DPI.

Implements CEGUI::Renderer.

const Sizef& CEGUI::OgreRenderer::getDisplaySize ( ) const
virtual

Return the size of the display or host window in pixels.

Returns
Size object describing the pixel dimesntions of the current display or host window.

Implements CEGUI::Renderer.

const String& CEGUI::OgreRenderer::getIdentifierString ( ) const
virtual

Return identification string for the renderer module.

Returns
String object holding text that identifies the Renderer in use.

Implements CEGUI::Renderer.

uint CEGUI::OgreRenderer::getMaxTextureSize ( ) const
virtual

Return the pixel size of the maximum supported texture.

Returns
Size of the maximum supported texture in pixels.

Implements CEGUI::Renderer.

Texture& CEGUI::OgreRenderer::getTexture ( const String name) const
virtual

Return a Texture object that was previously created by calling the createTexture functions.

Parameters
nameString holding the name of the Texture object to be returned.

Implements CEGUI::Renderer.

const Ogre::Matrix4& CEGUI::OgreRenderer::getWorldViewProjMatrix ( ) const

Return a const reference to the final transformation matrix that should be used when transforming geometry.

Note
The projection used when building this matrix is correctly adjusted according to whether the current Ogre::RenderTarget requires textures to be flipped (i.e it does the right thing for both D3D and OpenGL).
void CEGUI::OgreRenderer::initialiseRenderStateSettings ( )

Sets all the required render states needed for CEGUI rendering.

This is a low-level function intended for certain advanced concepts; in general it will not be required to call this function directly, since it is called automatically by the system when rendering is done.

bool CEGUI::OgreRenderer::isFrameControlExecutionEnabled ( ) const

Returns whether rendering done by CEGUI will be wrapped with calls to Ogre::RenderSystem::_beginFrame and Ogre::RenderSystem::_endFrame.

This defaults to enabled and is required when using the default hook
that automatically calls CEGUI::System::renderGUI via a frame listener.
If you disable this setting, the automated rendering will also be
disabled, which is useful when you wish to perform your own calls to the
CEGUI::System::renderGUI function (and is the sole purpose for this
setting).
Returns
  • true if _beginFrame and _endFrame will be called.
  • false if _beginFrame and _endFrame will not be called (also means default renderGUI call will not be made).
bool CEGUI::OgreRenderer::isUsingShaders ( ) const

Returns whether the OgreRenderer is currently set to use shaders when doing its rendering operations.

Returns
  • true if rendering is being done using shaders.
  • false if rendering is being done using the fixed function pipeline
void CEGUI::OgreRenderer::setDefaultRootRenderTarget ( Ogre::RenderTarget &  target)

Sets the Ogre::RenderTarget that should be targetted by the default GUIContext.

Parameters
targetReference to the Ogre::RenderTarget object that is to be used as the target for output from the default GUIContext.
void CEGUI::OgreRenderer::setDisplaySize ( const Sizef size)
virtual

Set the size of the display or host window in pixels for this Renderer object.

This is intended to be called by the System as part of the notification
process when display size changes are notified to it via the
System::notifyDisplaySizeChanged function.
Note
The Renderer implementation should not use this function other than to perform internal state updates on the Renderer and related objects.
Parameters
sizeSize object describing the dimesions of the current or host window in pixels.

Implements CEGUI::Renderer.

void CEGUI::OgreRenderer::setFrameControlExecutionEnabled ( const bool  enabled)

Controls whether rendering done by CEGUI will be wrapped with calls to Ogre::RenderSystem::_beginFrame and Ogre::RenderSystem::_endFrame.

This defaults to enabled and is required when using the default hook
that automatically calls CEGUI::System::renderGUI via a frame listener.
If you disable this setting, the automated rendering will also be
disabled, which is useful when you wish to perform your own calls to the
CEGUI::System::renderGUI function (and is the sole purpose for this
setting).
Parameters
enabled
  • true if _beginFrame and _endFrame should be called.
  • false if _beginFrame and _endFrame should not be called (also disables default renderGUI call).
void CEGUI::OgreRenderer::setUsingShaders ( const bool  use_shaders)

Set whether the OgreRenderer shound use shaders when performing its rendering operations.

Parameters
use_shaders
  • true if rendering shaders should be used to perform rendering.
  • false if the fixed function pipeline should be used to perform rendering.
Note
When compiled against Ogre 1.8 or later, shaders will automatically be enabled if the render sytem does not support the fixed function pipeline (such as with Direct3D 11). If you are compiling against earlier releases of Ogre, you must explicity enable the use of shaders by calling this function - if you are unsure what you'll be compiling against, it is safe to call this function anyway.
void CEGUI::OgreRenderer::updateShaderParams ( ) const

Updates the shader constant parameters (i.e. uniforms).

You do not normally need to call this function directly. Some may need to call this function if you're doing non-standard or advanced things.