OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Ogre::CompositorManager2 Class Reference

Main system for managing Render Targets through the use of nodes. More...

#include <OgreCompositorManager2.h>

+ Inheritance diagram for Ogre::CompositorManager2:
+ Collaboration diagram for Ogre::CompositorManager2:

Public Types

typedef map< IdString,
CompositorNodeDef * >::type 
CompositorNodeDefMap
 

Public Member Functions

 CompositorManager2 (RenderSystem *renderSystem)
 
 ~CompositorManager2 ()
 
void _swapAllFinalTargets (void)
 
void _update (void)
 
CompositorNodeDefaddNodeDefinition (const String &name)
 Returns a new node definition. The name must be unique, throws otherwise. More...
 
CompositorShadowNodeDefaddShadowNodeDefinition (const String &name)
 Returns a new node definition. The name must be unique, throws otherwise. More...
 
CompositorWorkspaceaddWorkspace (SceneManager *sceneManager, RenderTarget *finalRenderTarget, Camera *defaultCam, IdString definitionName, bool bEnabled, int position=-1)
 Main function to start rendering. More...
 
CompositorWorkspaceaddWorkspace (SceneManager *sceneManager, const CompositorChannel &finalRenderTarget, Camera *defaultCam, IdString definitionName, bool bEnabled, int position=-1)
 Overload that allows a full RenderTexture to be used as render target (see CubeMapping demo) More...
 
CompositorWorkspaceDefaddWorkspaceDefinition (IdString name)
 Returns a new workspace definition. More...
 
void connectOutput (CompositorNode *finalNode, size_t inputChannel)
 The final rendering is done by passing the RenderWindow to one of the input channels. More...
 
void createBasicWorkspaceDef (const IdString &workspaceDefName, const ColourValue &backgroundColour, IdString shadowNodeName=IdString())
 Utility helper to create a basic workspace to get you out of the rush. More...
 
CompositorPassProvidergetCompositorPassProvider (void) const
 
size_t getFrameCount (void) const
 Returns how many times _update has been called. More...
 
const CompositorNodeDefgetNodeDefinition (IdString nodeDefName) const
 Returns the node definition with the given name. Throws if not found. More...
 
CompositorNodeDefgetNodeDefinitionNonConst (IdString nodeDefName) const
 getNodeDefinition. More...
 
const CompositorNodeDefMapgetNodeDefinitions (void) const
 Returns a const iterator to all existing definitions. More...
 
TexturePtr getNullShadowTexture (PixelFormat format)
 Get an appropriately defined 'null' texture, i.e. More...
 
size_t getNumWorkspaces (void) const
 
const CompositorShadowNodeDefgetShadowNodeDefinition (IdString nodeDefName) const
 Returns the node definition with the given name. Throws if not found. More...
 
Rectangle2DgetSharedFullscreenQuad (void) const
 Returns a shared fullscreen rectangle/triangle useful for PASS_QUAD passes. More...
 
Rectangle2DgetSharedFullscreenTriangle (void) const
 Returns a shared fullscreen rectangle/triangle useful for PASS_QUAD passes. More...
 
CompositorWorkspaceDefgetWorkspaceDefinition (IdString name) const
 Returns the workspace definition with the given name. Throws if not found. More...
 
bool hasNodeDefinition (IdString nodeDefName) const
 Returns true if a node definition with the given name exists. More...
 
bool hasWorkspaceDefinition (IdString name) const
 Returns true if a workspace definition with the given name exists. More...
 
void operator delete (void *ptr)
 
void operator delete (void *ptr, void *)
 
void operator delete (void *ptr, const char *, int, const char *)
 
void operator delete[] (void *ptr)
 
void operator delete[] (void *ptr, const char *, int, const char *)
 
void * operator new (size_t sz, const char *file, int line, const char *func)
 operator new, with debug line info More...
 
void * operator new (size_t sz)
 
void * operator new (size_t sz, void *ptr)
 placement operator new More...
 
void * operator new[] (size_t sz, const char *file, int line, const char *func)
 array operator new, with debug line info More...
 
void * operator new[] (size_t sz)
 
void removeAllNodeDefinitions (void)
 Removes all node defs. More...
 
void removeAllShadowNodeDefinitions (void)
 Removes all shadow nodes defs. More...
 
void removeAllWorkspaceDefinitions (void)
 
void removeAllWorkspaces (void)
 Removes all workspaces. Make sure you don't hold any reference to a CompositorWorkpace! More...
 
void removeWorkspace (CompositorWorkspace *workspace)
 Removes the given workspace. Pointer is no longer valid after this call. More...
 
void setCompositorPassProvider (CompositorPassProvider *passProvider)
 Sets a custom pass provider in order to implement custom passes in your nodes. More...
 
void validateAllNodes ()
 Calls. More...
 

Protected Types

typedef map< IdString,
CompositorShadowNodeDef * >
::type 
CompositorShadowNodeDefMap
 
typedef vector
< CompositorShadowNodeDef * >
::type 
CompositorShadowNodeDefVec
 
typedef map< IdString,
CompositorWorkspaceDef * >
::type 
CompositorWorkspaceDefMap
 
typedef vector
< CompositorWorkspace * >
::type 
WorkspaceVec
 

Protected Member Functions

void validateNodes (void)
 

Protected Attributes

CompositorPassProvidermCompositorPassProvider
 For custom passes. More...
 
size_t mFrameCount
 
CompositorNodeDefMap mNodeDefinitions
 
TextureVec mNullTextureList
 
RenderSystemmRenderSystem
 
CompositorShadowNodeDefMap mShadowNodeDefs
 
Rectangle2DmSharedQuadFS
 
Rectangle2DmSharedTriangleFS
 
CompositorShadowNodeDefVec mUnfinishedShadowNodes
 
CompositorWorkspaceDefMap mWorkspaceDefs
 
WorkspaceVec mWorkspaces
 

Detailed Description

Main system for managing Render Targets through the use of nodes.

All applications must at least define a workspace definition and create a workspace instance in order to start rendering.

Remarks
The CompositorManager2 works by defining definitions which tell how the instance will behave. The top down view is the following: Workspace Node Target PASS_SCENE PASS_QUAD PASS_CLEAR PASS_STENCIL PASS_RESOLVE Shadow Node A Node definition must be created first. Inside the Node Def. different passes can be defined including which targets they should render to. Once the definitions are set, a workspace instance must be created using addWorkspace and rendering will start automatically. Each definition is shared by all instances, and is assumed to be immutable (read only) for the life time of those objects.
If you wish to change the definitions, you should destroy all instances first. In theory many changes can actually happen in real time without any harm, but that depends on how the code was written and thus the behavior is undefined.
A node has inputs (textures), local textures, and outputs. It can also directly global textures that are defined in a workspace definition. There a few basic rules: Global Textures use the "global_" prefix. For example "global_myRT" is a global texture. Trying to create a Local texture with that name will throw. Global Textures can't be used as node input nor output. Textures that came as Input can be used as Output. A node may have no Input nor Output. Shadow Nodes can't have input, but can have output to be used with other nodes.
Shadow Nodes are particular case of Nodes which are used for rendering shadow maps, and can only be references from a PASS_SCENE object; and will be executed when that pass is. After the pass is executed, its output can be used for other regular Nodes (i.e. for postprocessing), which enables the possibility of easily creating RSM (Reflective Shadow Maps) for Global Illumination calculations.
For more information
See also
CompositorNode &
CompositorShadowNode

Definition at line 95 of file OgreCompositorManager2.h.

Member Typedef Documentation

Definition at line 111 of file OgreCompositorManager2.h.

Constructor & Destructor Documentation

Ogre::CompositorManager2::CompositorManager2 ( RenderSystem renderSystem)
Ogre::CompositorManager2::~CompositorManager2 ( )

Member Function Documentation

void Ogre::CompositorManager2::_swapAllFinalTargets ( void  )
void Ogre::CompositorManager2::_update ( void  )
CompositorNodeDef* Ogre::CompositorManager2::addNodeDefinition ( const String name)

Returns a new node definition. The name must be unique, throws otherwise.

CompositorShadowNodeDef* Ogre::CompositorManager2::addShadowNodeDefinition ( const String name)

Returns a new node definition. The name must be unique, throws otherwise.

CompositorWorkspace* Ogre::CompositorManager2::addWorkspace ( SceneManager sceneManager,
RenderTarget finalRenderTarget,
Camera defaultCam,
IdString  definitionName,
bool  bEnabled,
int  position = -1 
)

Main function to start rendering.

Creates a workspace instance based on a workspace definition.

Parameters
sceneManagerThe SceneManager this workspace will be associated with. You can have multiple scene managers, each with multiple workspaces. Those workspaces can be set to render to the same final render target, regardless of scene manager (or not).
finalRenderTargetThe final RT where the workspace will be rendered to. Usually the RenderWindow. We need this pointer in order to correctly create RTTs that depend on the final target's width, height, gamma & fsaa settings. This pointer will be used for "connectOutput" channels (
See also
CompositorWorkspaceDef::connectOutput) In theory if none of your nodes use width & height relative to final RT & you don't use connectOutput, this pointer could be null. Although it's not recommended nor explicitly supported.
Parameters
defaultCamDefault camera to use when a camera name wasn't specified explicitly in a pass definition (i.e. PASS_SCENE passes). This pointer can be null if you promise to use all explicit camera names in your passes (and those cameras have already been created)
definitionNameThe unique name of the workspace definition
bEnabledTrue if this workspace should start enabled, false otherwise.
positionIf there are multiple workspaces, specifies the order in which this compositor should be updated. i.e. "0" means this new workspace gets updated first. Note that subsequent calls will place other workspaces to be updated first. Typically you will want to update workspace that renders to the RenderWindow last (depending on what you do with RTs, some OSes, like OS X, may not like it). Defaults to -1; which means update last.
CompositorWorkspace* Ogre::CompositorManager2::addWorkspace ( SceneManager sceneManager,
const CompositorChannel finalRenderTarget,
Camera defaultCam,
IdString  definitionName,
bool  bEnabled,
int  position = -1 
)

Overload that allows a full RenderTexture to be used as render target (see CubeMapping demo)

CompositorWorkspaceDef* Ogre::CompositorManager2::addWorkspaceDefinition ( IdString  name)

Returns a new workspace definition.

The name must be unique, throws otherwise.

Remarks
Setting workspace def's connections must be done after all node definitions have been created
void Ogre::CompositorManager2::connectOutput ( CompositorNode finalNode,
size_t  inputChannel 
)

The final rendering is done by passing the RenderWindow to one of the input channels.

This functions does exactly that.

void Ogre::CompositorManager2::createBasicWorkspaceDef ( const IdString workspaceDefName,
const ColourValue backgroundColour,
IdString  shadowNodeName = IdString() 
)

Utility helper to create a basic workspace to get you out of the rush.

Advanced users will probably prefer to create the workspace definition using scripts or manipulating functions directly

Parameters
workspaceDefNameName to give to the workspace definition. Must be unique
backgroundColourClear colour
shadowNodeNameName of the shadow node. Leave blank if no shadows. Caller is supposed to have set the shadow node correctly
CompositorPassProvider* Ogre::CompositorManager2::getCompositorPassProvider ( void  ) const
size_t Ogre::CompositorManager2::getFrameCount ( void  ) const
inline

Returns how many times _update has been called.

Definition at line 174 of file OgreCompositorManager2.h.

const CompositorNodeDef* Ogre::CompositorManager2::getNodeDefinition ( IdString  nodeDefName) const

Returns the node definition with the given name. Throws if not found.

CompositorNodeDef* Ogre::CompositorManager2::getNodeDefinitionNonConst ( IdString  nodeDefName) const

getNodeDefinition.

Returns a non-const pointer. Use this only if you know what you're doing. Modifying a NodeDef while it's being used by CompositorNode instances is undefined. It's safe if you're sure it's not being used.

const CompositorNodeDefMap& Ogre::CompositorManager2::getNodeDefinitions ( void  ) const
inline

Returns a const iterator to all existing definitions.

Definition at line 149 of file OgreCompositorManager2.h.

TexturePtr Ogre::CompositorManager2::getNullShadowTexture ( PixelFormat  format)

Get an appropriately defined 'null' texture, i.e.

one which will always result in no shadows.

size_t Ogre::CompositorManager2::getNumWorkspaces ( void  ) const
inline

Definition at line 238 of file OgreCompositorManager2.h.

const CompositorShadowNodeDef* Ogre::CompositorManager2::getShadowNodeDefinition ( IdString  nodeDefName) const

Returns the node definition with the given name. Throws if not found.

Rectangle2D* Ogre::CompositorManager2::getSharedFullscreenQuad ( void  ) const
inline

Returns a shared fullscreen rectangle/triangle useful for PASS_QUAD passes.

Remarks
Pointer is valid throughout the lifetime of this CompositorManager2

Definition at line 187 of file OgreCompositorManager2.h.

Rectangle2D* Ogre::CompositorManager2::getSharedFullscreenTriangle ( void  ) const
inline

Returns a shared fullscreen rectangle/triangle useful for PASS_QUAD passes.

Remarks
Pointer is valid throughout the lifetime of this CompositorManager2

Definition at line 185 of file OgreCompositorManager2.h.

CompositorWorkspaceDef* Ogre::CompositorManager2::getWorkspaceDefinition ( IdString  name) const

Returns the workspace definition with the given name. Throws if not found.

bool Ogre::CompositorManager2::hasNodeDefinition ( IdString  nodeDefName) const

Returns true if a node definition with the given name exists.

bool Ogre::CompositorManager2::hasWorkspaceDefinition ( IdString  name) const

Returns true if a workspace definition with the given name exists.

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr)
inlineinherited

Definition at line 96 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr,
void *   
)
inlineinherited

Definition at line 102 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr,
const char *  ,
int  ,
const char *   
)
inlineinherited

Definition at line 108 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete[] ( void *  ptr)
inlineinherited

Definition at line 113 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete[] ( void *  ptr,
const char *  ,
int  ,
const char *   
)
inlineinherited

Definition at line 119 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz,
const char *  file,
int  line,
const char *  func 
)
inlineinherited

operator new, with debug line info

Definition at line 68 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz)
inlineinherited

Definition at line 73 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz,
void *  ptr 
)
inlineinherited

placement operator new

Definition at line 79 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new[] ( size_t  sz,
const char *  file,
int  line,
const char *  func 
)
inlineinherited

array operator new, with debug line info

Definition at line 86 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new[] ( size_t  sz)
inlineinherited

Definition at line 91 of file OgreMemoryAllocatedObject.h.

void Ogre::CompositorManager2::removeAllNodeDefinitions ( void  )

Removes all node defs.

Make sure there are no active nodes using the definition!

Remarks
Call removeAllWorkspaceDefinitions first
void Ogre::CompositorManager2::removeAllShadowNodeDefinitions ( void  )

Removes all shadow nodes defs.

Make sure there are no active nodes using the definition!

Remarks
Call removeAllWorkspaceDefinitions first
void Ogre::CompositorManager2::removeAllWorkspaceDefinitions ( void  )
void Ogre::CompositorManager2::removeAllWorkspaces ( void  )

Removes all workspaces. Make sure you don't hold any reference to a CompositorWorkpace!

void Ogre::CompositorManager2::removeWorkspace ( CompositorWorkspace workspace)

Removes the given workspace. Pointer is no longer valid after this call.

void Ogre::CompositorManager2::setCompositorPassProvider ( CompositorPassProvider passProvider)

Sets a custom pass provider in order to implement custom passes in your nodes.

See also
CompositorPassProvider
void Ogre::CompositorManager2::validateAllNodes ( )

Calls.

See also
CompositorNode::_validateAndFinish on all objects who aren't yet validated
void Ogre::CompositorManager2::validateNodes ( void  )
protected

Member Data Documentation

CompositorPassProvider* Ogre::CompositorManager2::mCompositorPassProvider
protected

For custom passes.

Definition at line 123 of file OgreCompositorManager2.h.

size_t Ogre::CompositorManager2::mFrameCount
protected

Definition at line 114 of file OgreCompositorManager2.h.

CompositorNodeDefMap Ogre::CompositorManager2::mNodeDefinitions
protected

Definition at line 101 of file OgreCompositorManager2.h.

TextureVec Ogre::CompositorManager2::mNullTextureList
protected

Definition at line 118 of file OgreCompositorManager2.h.

RenderSystem* Ogre::CompositorManager2::mRenderSystem
protected

Definition at line 116 of file OgreCompositorManager2.h.

CompositorShadowNodeDefMap Ogre::CompositorManager2::mShadowNodeDefs
protected

Definition at line 105 of file OgreCompositorManager2.h.

Rectangle2D* Ogre::CompositorManager2::mSharedQuadFS
protected

Definition at line 120 of file OgreCompositorManager2.h.

Rectangle2D* Ogre::CompositorManager2::mSharedTriangleFS
protected

Definition at line 119 of file OgreCompositorManager2.h.

CompositorShadowNodeDefVec Ogre::CompositorManager2::mUnfinishedShadowNodes
protected

Definition at line 106 of file OgreCompositorManager2.h.

CompositorWorkspaceDefMap Ogre::CompositorManager2::mWorkspaceDefs
protected

Definition at line 109 of file OgreCompositorManager2.h.

WorkspaceVec Ogre::CompositorManager2::mWorkspaces
protected

Definition at line 112 of file OgreCompositorManager2.h.


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