File OgreObjectManager.h

namespace Ogre

File: MovableText.h

Description: This creates a billboarding object that display a text. Note: This object must have a dedicated scene node since it will rotate it to face the camera (OGRE 2.1)

Author

2003 by cTh see gavocanov@rambler.ru 2006 by barraq see nospam@barraquand.com 2012 to work with newer versions of OGRE by MindCalamity mindcalamity@gmail.com 2015 to work on OGRE 2.1 (but not on older versions anymore) by Jayray jeremy.richert1@gmail.com

namespace Gsage
class OgreObjectManager : public EventDispatcher

Public Functions

OgreObjectManager(OgreRenderSystem *rs)
virtual ~OgreObjectManager()
OgreObject *create(const DataProxy &dict, const std::string &owner, Ogre::SceneManager *sceneManager, Ogre::SceneNode *parent = 0)

Create object from the DataProxy

Parameters
  • dict: DataProxy with all values (dict should contain type field)

  • owner: Owner entity of the created object

  • sceneManager: Ogre::SceneManager to create object in

  • parent: Parent object to attach to

OgreObject *create(const DataProxy &dict, const std::string &owner, Ogre::SceneManager *sceneManager, const std::string &type, Ogre::SceneNode *parent = 0)

Create object from the DataProxy

Parameters
  • dict: DataProxy with all values

  • owner: Owner entity of the created object

  • sceneManager: Ogre::SceneManager to create object in

  • type: Object type string, defined explicitly

  • parent: Parent object to attach to

OgreObject *create(const DataProxy &dict, const std::string &owner, Ogre::SceneManager *sceneManager, const std::string &type, const DataProxy &params, OgreObject *parent = 0)

Create object from the DataProxy

Parameters
  • dict: DataProxy with all values

  • owner: Owner entity of the created object

  • sceneManager: Ogre::SceneManager to create object in

  • type: Object type string, defined explicitly

  • parent: Parent object to attach to

template<typename C>
C *create(const DataProxy &dict, const std::string &owner, Ogre::SceneManager *sceneManager, Ogre::SceneNode *parent = 0)

See

OgreObjectManager::create

void destroy(OgreObject *object)

Destroy object

Parameters
  • object: Object to destroy

template<typename C>
void registerElement(const std::string &type)

Register new element type, so factory will be able to create it

Parameters
  • type: String type representation

template<typename C>
void registerElement()

Register new element type, so factory will be able to create id. For this method, visual element should have static std::string TYPE defined

bool unregisterElement(const std::string &type)

Unregister existing element type It will destroy all existing objects of that type

Parameters
  • type: String type representation

template<typename C>
bool unregisterElement()

Unregister existing element type It will destroy all existing objects of that type

OgreRenderSystem *getRenderSystem()

Get targeted render system instance

Private Types

typedef std::map<std::string, OgreObjectPool *> OgreObjectsCollections

Private Members

OgreObjectsCollections mObjects
OgreRenderSystem *mRenderSystem
template<typename C>
class ConcreteOgreObjectPool : public Gsage::OgreObjectManager::OgreObjectPool

Public Functions

virtual ~ConcreteOgreObjectPool()
OgreObject *allocate()
void remove(OgreObject *object)
void clear()

Private Members

ObjectPool<C> mObjects
class OgreObjectPool

Public Functions

virtual ~OgreObjectPool()
virtual OgreObject *allocate() = 0
virtual void remove(OgreObject *object) = 0
class OgreObjectManagerEvent : public Event
#include <OgreObjectManager.h>

Event related to factory lifecycle

Public Functions

OgreObjectManagerEvent(Event::ConstType type, const std::string &id, OgreObject *object = 0)
virtual ~OgreObjectManagerEvent()
const std::string &getId() const

Get factory id that was unregistered or object id related to event

const OgreObject *getObject() const

Related object

Public Static Attributes

const Event::Type FACTORY_UNREGISTERED

Factory was unregistered

const Event::Type OBJECT_DESTROYED

Object was destroyed

Private Members

std::string mId
OgreObject *mObject