File OgreRenderSystem.h

Variables

const std::string OGRE_SECTION = "OgreRenderer"
const std::string OGRE_PLUGINS_PATH = "PluginsPath"
const std::string OGRE_CONFIG_PATH = "ConfigPath"
const std::string OGRE_RESOURCES = "Resources"
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 OgreLogRedirect : public LogListener
#include <OgreRenderSystem.h>

Class, used to redirect all ogre output to the easylogging++

Private Functions

void messageLogged(const std::string &message, Ogre::LogMessageLevel lml, bool maskDebug, const std::string &system, bool &skipMessage)
class OgreRenderSystem : public ComponentStorage<OgreRenderComponent>, public RenderQueueListener, public EventDispatcher, public EventSubscriber<OgreRenderSystem>, public RenderSystem

Public Types

typedef std::vector<Entity *> Entities
typedef std::vector<Ogre::MovableObject *> OgreEntities

Enumerable of Ogre::MovableObject

Public Functions

OgreRenderSystem()
virtual ~OgreRenderSystem()
virtual bool initialize(const DataProxy &settings)

Intializes ogre render system

Parameters
  • settings: DataProxy with initial settings for the render system

virtual void shutdown()

Shutdown OGRE

virtual bool prepareComponent(OgreRenderComponent *c)

Initializes OgreRenderComponent, injects objectManager, resourceManager and sceneManager

Parameters

virtual bool fillComponentData(OgreRenderComponent *component, const DataProxy &data)

Finalizes setup

Return

false if failed to initialize component for some reason

Parameters

virtual void update(const double &time)

Update render system

Parameters
  • time: Elapsed time

virtual void updateComponent(OgreRenderComponent *component, Entity *entity, const double &time)

Update OgreRenderComponent

Parameters
  • component: OgreRenderComponent to update

  • entity: Entity that owns that component

  • time: Elapsed time

virtual bool removeComponent(OgreRenderComponent *component)

Remove render component from the system. Removes all related visual nodes

Parameters

virtual bool configure(const DataProxy &config)

Reconfigure render system

Parameters
  • config: DataProxy with configs

DataProxy &getConfig()

Get current configs of the system

GeomPtr getGeometry(const BoundingBox &bounds, int flags = 0xFF)

Get implementation independent Geometry information

Return

GeomPtr

Parameters
  • bounds: get entities in bounds

  • flags: filter entities by flags (default is all)

GeomPtr getGeometry(std::vector<std::string> entities)

Get implementation independent Geometry information

Return

GeomPtr

Parameters
  • entities: filter entities by names

virtual TexturePtr createTexture(RenderSystem::TextureHandle handle, const DataProxy &parameters)

Create texture manually

Parameters
  • handle: texture id

  • parameters: variable parameters that can be used for texture creation

virtual TexturePtr getTexture(RenderSystem::TextureHandle handle)

Get texture by name

Parameters
  • handle: texture id

virtual bool deleteTexture(RenderSystem::TextureHandle handle)

Delete texture by handle

Return

true if succeed

Parameters
  • handle: texture id

virtual void renderQueueStarted(Ogre::uint8 queueGroupId, const Ogre::String &invocation, bool &skipThisInvocation)

Callback for ui updating 1.x, 2.0

virtual void renderQueueEnded(Ogre::uint8 queueGroupId, const Ogre::String &invocation, bool &skipThisInvocation)

Render queue event pass through

template<typename T>
void registerElement()

Register new type of factory in the render system

template<typename T>
bool unregisterElement()

Unregister factory type

Ogre::RenderWindow *getRenderWindow()

Get ogre render window

Ogre::SceneManager *getSceneManager()

Get ogre scene manager

Ogre::RenderSystem *getRenderSystem()

Get ogre render system

OgreEntities getEntities(const unsigned int &query, const BoundingBox &bounds)

Gets all scene entities

Parameters
  • query: Filter entities by some query, default is all

  • bounds: filter entities which are intersected by bounds

OgreEntities getEntities(const unsigned int &query = 0xFF)

Gets all scene entities

Parameters
  • query: Filter entities by some query, default is all

Entities getObjectsInRadius(const Ogre::Vector3 &center, float distance, const unsigned int flags = 0xFF, const std::string &id = "")

Get objects in radius

Return

list of entities

Parameters
  • position: Point to search around

  • distance: Radius of the sphere query

virtual void setWidth(unsigned int width, const std::string &target = "")

Set render target width

Parameters
  • target: Render target name

virtual unsigned int getWidth(const std::string &target = "") const

Get render window width

virtual void setHeight(unsigned int height, const std::string &target = "")

Set render target height

Parameters
  • target: Render target name

virtual unsigned int getHeight(const std::string &target = "") const

Get render window height

virtual void setSize(unsigned int width, unsigned int height, const std::string &target = "")

Set size of render target

Parameters
  • target: Render target name

void renderCameraToTarget(const std::string &cameraName, const std::string &target)

Render camera to texture with name

Parameters
  • cameraName: Name of the camera to use

  • target: Name of RTT to render to

void renderCameraToTarget(Ogre::Camera *cam, const std::string &target)

Render camera to texture with name

Parameters
  • cam: Camera pointer

  • target: Name of RTT to render to

RenderTargetPtr createRenderTarget(const std::string &name, RenderTargetType::Type type, DataProxy parameters)

Create new render target

Parameters
  • name: Render target name

  • type: Render target type

  • parameters: Additional parameters

RenderTargetPtr getRenderTarget(const std::string &name)

Get render target by name

Parameters
  • name: Render target name

RenderTargetPtr getRenderTarget(Ogre::RenderTarget *target)

Get render target by wrapped Ogre::RenderTarget*

Parameters
  • target: Ogre::RenderTarget

RenderTargetPtr getMainRenderTarget()

Get main render target (window)

MaterialLoader *getMaterialLoader()

Get material loader

bool allowMultithreading()

Allow multithreaded mode for OgreRenderSystem

void queueMutation(ObjectMutation::Callback callback)

Queue object mutation is called from Ogre wrappers

Parameters
  • callback: Mutation callback

OgreObjectManager *getObjectManager()

Gets object manager

Public Static Attributes

const std::string ID

Protected Types

typedef std::queue<DataProxy> ComponentLoadQueue
typedef std::map<std::string, RenderTargetPtr> RenderTargets
typedef std::map<Ogre::RenderTarget *, std::string> RenderTargetReverseIndex
typedef std::map<std::string, RenderTargetPtr> RenderWindowsByHandle

Protected Functions

bool handleWindowResized(EventDispatcher *sender, const Event &event)

Handle window resizing

Parameters
  • sender: Engine

  • event: WindowEvent

bool installPlugin(const std::string &name)
GeomPtr getGeometry(OgreEntities entities)
void removeAllRenderTargets()

Protected Attributes

Ogre::Root *mRoot
Ogre::SceneManager *mSceneManager
Ogre::RenderSystem *mRenderSystem
Ogre::LogManager *mLogManager
Ogre::FontManager *mFontManager
Ogre::Viewport *mViewport
Ogre::ManualMovableTextRendererFactory *mManualMovableTextParticleFactory
OgreLogRedirect mLogRedirect
OgreObjectManager mObjectManager
WindowEventListener *mWindowEventListener
ResourceManager *mResourceManager
MaterialLoader *mMaterialLoader
ComponentLoadQueue mLoadQueue
RenderTargets mRenderTargets
RenderTargetReverseIndex mRenderTargetsReverseIndex
RenderTargetFactory mRenderTargetFactory
RenderWindowsByHandle mRenderWindowsByHandle
RenderTargetPtr mWindow
ThreadSafeQueue<ObjectMutation> mMutationQueue
ManualTextureManager mManualTextureManager