syBR::Renderer::RenderSystem Class Reference

Ogre3D rendering system class. More...

#include <RenderSystem.hpp>

List of all members.

Public Member Functions

bool initialize (const bool sceneManager)
 Initialize renderer.
void update ()
 Update rendering system.
void present ()
 Present rendered graphics to the screen.
bool getStatus () const
 Get status of the rendering system.
void * getWindowHandle () const
 Get window handle.
Ogre::Root * getOgre () const
 Get Ogre root object.
Ogre::SceneManager * getSceneManager () const
 Get main scene manager.
Ogre::RenderWindow * getRenderWindow () const
 Get rendering window.
bool loadTexture (const std::string &texture)
 Load texture.
bool createDynamicTexture (const std::string &name, const unsigned int width, const unsigned int height)
 Create a dynamic texture.
bool updateDynamicTexture (const std::string &name, const unsigned char *data, const unsigned int dataRowStride)
 Update a dynamic texture.
void deleteDynamicTexture (const std::string &name)
 Delete a dynamic texture.
bool createOverlay (const std::string &name, const std::string &material, const bool dynamicTextureMaterial, const float x, const float y, const float width, const float height)
 Create an overlay.
void deleteOverlay (const std::string &name)

Static Public Member Functions

static bool initializeSingleton (const std::string &ogreLogPrefix, Core::Logger *pLogger)
 Initialize singleton.
static RenderSystemgetSingleton ()
 Retrieve singleton instance.
static void terminateSingleton (Core::Logger *pLogger)
 Terminate singleton.

Private Member Functions

 RenderSystem (const std::string &ogreLogPrefix, Core::Logger *pLogger)
 Constructor.
 ~RenderSystem ()
 Destructor.

Private Attributes

Core::Loggerm_pLogger
 Pointer to the logger to be used.
Ogre::Root * m_pOgre
 Ogre main object used for rendering.
Ogre::LogManager * m_pLogManager
Ogre::RenderWindow * m_pOgreWindow
Ogre::SceneManager * m_pSceneManager
Ogre::Camera * m_pOgreCamera
Ogre::Viewport * m_pOgreViewport
bool m_status
 One of these :
  • true if the rendering system is willing to continue
  • false it it wants to stop the application.

std::map
< std::string,
DynamicTexture
m_mapDynamicTextures
 Map of dynamic textures.
std::map
< std::string,
Ogre::Overlay * > 
m_mapOverlays
 Map of overlays.

Static Private Attributes

static RenderSystemsm_pSingleton = NULL
 Singleton instance.

Classes

struct  DynamicTexture
 Structure holding dynamic texture informations. More...


Detailed Description

Ogre3D rendering system class.

This is the main class of the rendering system.


Constructor & Destructor Documentation

syBR::Renderer::RenderSystem::RenderSystem ( const std::string &  ogreLogPrefix,
Core::Logger pLogger 
) [private]

Constructor.

Create Ogre rendering object and load Ogre settings.

Parameters:
ogreLogPrefix Prefix to use for the name of the Ogre3D log file, so that it will be {logPrefix}-ogre3d.log
pLogger Pointer to the instance of the logger to use

syBR::Renderer::RenderSystem::~RenderSystem (  )  [private]

Destructor.


Member Function Documentation

bool syBR::Renderer::RenderSystem::initializeSingleton ( const std::string &  ogreLogPrefix,
Core::Logger pLogger 
) [static]

Initialize singleton.

Create a new instance of the render system only if none already exists.

Parameters:
ogreLogPrefix Prefix to use for the name of the Ogre3D log file, so that it will be {ogreLogPrefix}-ogre3d.log
pLogger Pointer to the instance of the logger to use
Returns:
One of these:
  • true in case of success
  • false if it failed to create a new instance of the render system when needed

RenderSystem * syBR::Renderer::RenderSystem::getSingleton (  )  [static]

Retrieve singleton instance.

Returns:
One of these:
  • Singleton instance if it has been initialized
  • NULL otherwise

void syBR::Renderer::RenderSystem::terminateSingleton ( Core::Logger pLogger  )  [static]

Terminate singleton.

Parameters:
pLogger Pointer to the instance of the logger to use

bool syBR::Renderer::RenderSystem::initialize ( const bool  sceneManager  ) 

Initialize renderer.

Initialize Ogre rendering engine and the scene manager if requested

Parameters:
sceneManager true to create a sceneManager and default viewport false otherwise
Returns:
One of these:
  • true in case of success
  • false otherwise

void syBR::Renderer::RenderSystem::update (  ) 

Update rendering system.

void syBR::Renderer::RenderSystem::present (  ) 

Present rendered graphics to the screen.

bool syBR::Renderer::RenderSystem::getStatus (  )  const

Get status of the rendering system.

This function is present in order the rendering system to be able to warn the game system that its window has been destroyed.

Returns:
One of these:
  • true if the rendering system is willing to continue
  • false it it wants to stop the application

void * syBR::Renderer::RenderSystem::getWindowHandle (  )  const

Get window handle.

Returns:
One of these:
  • Handle of the rendering window if the render system has been initialized
  • NULL otherwise

Ogre::Root * syBR::Renderer::RenderSystem::getOgre (  )  const

Get Ogre root object.

Returns:
Pointer to Ogre root object

Ogre::SceneManager * syBR::Renderer::RenderSystem::getSceneManager (  )  const

Get main scene manager.

Returns:
Main scene manager

Ogre::RenderWindow * syBR::Renderer::RenderSystem::getRenderWindow (  )  const

Get rendering window.

Returns:
Rendering window

bool syBR::Renderer::RenderSystem::loadTexture ( const std::string &  texture  ) 

Load texture.

Parameters:
texture Name of the texture to load
Returns:
One of these:
  • true if the texture has already been loaded or if its loading was successful
  • false otherwise
Check if a resource has already been loaded and try to load it if it's not the case.

bool syBR::Renderer::RenderSystem::createDynamicTexture ( const std::string &  name,
const unsigned int  width,
const unsigned int  height 
)

Create a dynamic texture.

Parameters:
name Name of the dynamic texture
width Width of the texture
height Height of the texture
Returns:
One of these:
  • true in case of success
  • false otherwise
Note:
It is advised to use power-of-two texture dimensions

bool syBR::Renderer::RenderSystem::updateDynamicTexture ( const std::string &  name,
const unsigned char *  data,
const unsigned int  dataRowStride 
)

Update a dynamic texture.

Parameters:
name Name of the dynamic texture to update
data Data to be copied to the texture
dataRowStride Stride of the data to be copied to the texture
Returns:
One of these:
  • true in case of success
  • false otherwise

void syBR::Renderer::RenderSystem::deleteDynamicTexture ( const std::string &  name  ) 

Delete a dynamic texture.

Parameters:
name Name of the dynamic texture to delete

bool syBR::Renderer::RenderSystem::createOverlay ( const std::string &  name,
const std::string &  material,
const bool  dynamicTextureMaterial,
const float  x,
const float  y,
const float  width,
const float  height 
)

Create an overlay.

Parameters:
name Name of the overlay to create
material Name of the material to use
dynamicTextureMaterial One of these:
  • true if material is the name of a dynamic texture
  • false otherwise
x Horizontal position of the overlay
y Vertical position of the overlay
width Width of the overlay
height Height of the overlay

void syBR::Renderer::RenderSystem::deleteOverlay ( const std::string &  name  ) 


Member Data Documentation

RenderSystem * syBR::Renderer::RenderSystem::sm_pSingleton = NULL [static, private]

Singleton instance.

Core::Logger* syBR::Renderer::RenderSystem::m_pLogger [private]

Pointer to the logger to be used.

Ogre::Root* syBR::Renderer::RenderSystem::m_pOgre [private]

Ogre main object used for rendering.

Ogre::LogManager* syBR::Renderer::RenderSystem::m_pLogManager [private]

Ogre::RenderWindow* syBR::Renderer::RenderSystem::m_pOgreWindow [private]

Ogre::SceneManager* syBR::Renderer::RenderSystem::m_pSceneManager [private]

Ogre::Camera* syBR::Renderer::RenderSystem::m_pOgreCamera [private]

Ogre::Viewport* syBR::Renderer::RenderSystem::m_pOgreViewport [private]

bool syBR::Renderer::RenderSystem::m_status [private]

One of these :

std::map<std::string, DynamicTexture> syBR::Renderer::RenderSystem::m_mapDynamicTextures [private]

Map of dynamic textures.

std::map<std::string, Ogre::Overlay*> syBR::Renderer::RenderSystem::m_mapOverlays [private]

Map of overlays.


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

Copyright © 2008 by Sebastien Frippiat
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License.
Last modified Tue Dec 30 17:57:34 2008