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

CompositorWorkspace. More...

#include <OgreCompositorWorkspaceDef.h>

+ Inheritance diagram for Ogre::CompositorWorkspaceDef:
+ Collaboration diagram for Ogre::CompositorWorkspaceDef:

Classes

struct  ChannelRoute
 

Public Types

enum  BoolSetting { BoolFalse, BoolTrue, BoolUndefined }
 
typedef list< ChannelRoute >::type ChannelRouteList
 
typedef map< IdString,
IdString >::type 
NodeAliasMap
 
enum  TextureSource { TEXTURE_INPUT, TEXTURE_LOCAL, TEXTURE_GLOBAL, NUM_TEXTURES_SOURCES }
 

Public Member Functions

 CompositorWorkspaceDef (IdString name, CompositorManager2 *compositorManager)
 
virtual ~CompositorWorkspaceDef ()
 
ChannelRouteList_getChannelRoutes (void)
 Gets direct access to the channel route (aka the interconnections between all of our nodes). More...
 
void addNodeAlias (IdString alias, IdString nodeName)
 An alias is explicitly used when the user wants to use multiple, independent instances of the same node. More...
 
TextureDefinitionaddTextureDefinition (const String &name)
 Creates a TextureDefinition with a given name, must be unique. More...
 
virtual IdString addTextureSourceName (const String &name, size_t index, TextureSource textureSource)
 Adds a texture name, whether a real one or an alias, and where to grab it from. More...
 
void clearAll (void)
 Clears everything: All node aliases, and their connections (including output connection). More...
 
void clearAllInterNodeConnections (void)
 Clears all the connection between channels of the nodes (. More...
 
void clearOutputConnections (void)
 Clears the connection from the "final output RenderTarget" (i.e. More...
 
void connect (IdString outNode, uint32 outChannel, IdString inNode, uint32 inChannel)
 Connects outNode's output channel to inNode's input channel. More...
 
void connect (IdString outNode, IdString inNode)
 Connects all outputs channels from outNode to all input channels from inNode. More...
 
void connectOutput (IdString inNode, uint32 inChannel)
 Connects the (probably "final") node by passing the RenderWindow in the given input channel. More...
 
const NodeAliasMapgetNodeAliasMap (void)
 Gets read-only access to the map to all added nodes and their aliases. More...
 
size_t getNumInputChannels (void) const
 This has O(N) complexity! (not cached, we look in mNameToChannelMap) More...
 
void getTextureSource (IdString name, size_t &index, TextureSource &textureSource) const
 Retrieves in which container to look for when looking to which texture is a given name associated with. 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 removeNodeAlias (IdString alias)
 Removes a particular Node. More...
 
void setNumLocalTextureDefinitions (size_t numTDs)
 Reserves enough memory for all texture definitions. More...
 

Static Public Member Functions

static CompositorChannel createTexture (const TextureDefinition &textureDef, const String &texName, const RenderTarget *finalTarget, RenderSystem *renderSys)
 
static void createTextures (const TextureDefinitionVec &textureDefs, CompositorChannelVec &inOutTexContainer, IdType id, bool uniqueNames, const RenderTarget *finalTarget, RenderSystem *renderSys)
 Utility function to create the textures based on a given set of texture definitions and put them in a container. More...
 
static void destroyTextures (CompositorChannelVec &inOutTexContainer, RenderSystem *renderSys)
 createTextures More...
 
static void recreateResizableTextures (const TextureDefinitionVec &textureDefs, CompositorChannelVec &inOutTexContainer, const RenderTarget *finalTarget, RenderSystem *renderSys, const CompositorNodeVec &connectedNodes, const CompositorPassVec *passes)
 Destroys & recreates only the textures that depend on the main RT (i.e. More...
 

Protected Types

typedef map< IdString, uint32 >
::type 
NameToChannelMap
 
typedef vector
< TextureDefinition >::type 
TextureDefinitionVec
 

Protected Member Functions

void createImplicitAlias (IdString nodeName)
 Checks if nodeName is already aliased (whether explicitly or implicitly). More...
 

Static Protected Member Functions

static void decodeTexSource (uint32 encodedVal, size_t &outIdx, TextureSource &outTexSource)
 
static uint32 encodeTexSource (size_t index, TextureSource textureSource)
 

Protected Attributes

NodeAliasMap mAliasedNodes
 
ChannelRouteList mChannelRoutes
 
CompositorManager2mCompositorManager
 Alias of the final node to send the RenderWindow to. More...
 
TextureSource mDefaultLocalTextureSource
 TextureSource to use by addLocalTextureDefinition. More...
 
uint32 mFinalInChannel
 
IdString mFinalNode
 Input Channel # to send the RenderWindow to. More...
 
TextureDefinitionVec mLocalTextureDefs
 
IdString mName
 
NameToChannelMap mNameToChannelMap
 Similar to. More...
 

Friends

class CompositorWorkspace
 

Detailed Description

CompositorWorkspace.

Workspace definitions assume all other definitions are already parsed as we need them to perform validation checks. Workspace definitions work by assigning aliases to each node. A node whose name is the same as its alias is called an implicit alias.

Remarks
Aliasing nodes allows having more than one instance of the same node.
Author
Matias N. Goldberg
Version
1.1

Definition at line 55 of file OgreCompositorWorkspaceDef.h.

Member Typedef Documentation

Definition at line 114 of file OgreTextureDefinition.h.

Definition at line 113 of file OgreTextureDefinition.h.

Member Enumeration Documentation

Enumerator
BoolFalse 
BoolTrue 
BoolUndefined 

Definition at line 65 of file OgreTextureDefinition.h.

Enumerator
TEXTURE_INPUT 
TEXTURE_LOCAL 

We got the texture through an input channel.

TEXTURE_GLOBAL 

We own the texture.

NUM_TEXTURES_SOURCES 

It's a global texture. Ask the manager for it.

Definition at line 57 of file OgreTextureDefinition.h.

Constructor & Destructor Documentation

Ogre::CompositorWorkspaceDef::CompositorWorkspaceDef ( IdString  name,
CompositorManager2 compositorManager 
)
virtual Ogre::CompositorWorkspaceDef::~CompositorWorkspaceDef ( )
inlinevirtual

Definition at line 96 of file OgreCompositorWorkspaceDef.h.

Member Function Documentation

ChannelRouteList& Ogre::CompositorWorkspaceDef::_getChannelRoutes ( void  )
inline

Gets direct access to the channel route (aka the interconnections between all of our nodes).

Useful for advanced C++ users who want fine control of the connections.

Remarks
Incorrect manipulation of the channel routes can lead to glitches or crashes. Remember:
  1. Two nodes can't connect to the same node alias on the same channel
  2. Don't reference a node or alias that isn't in mAliasedNodes by the time the Workspace is instantiated
  3. A node that doesn't have all of its input channels connected is incomplete and should be disabled for the Workspace instance to be valid.

Definition at line 193 of file OgreCompositorWorkspaceDef.h.

void Ogre::CompositorWorkspaceDef::addNodeAlias ( IdString  alias,
IdString  nodeName 
)

An alias is explicitly used when the user wants to use multiple, independent instances of the same node.

Each alias equals one instance. An implicit alias is when the name of the alias and it's node name match.

Remarks
When the name of the node and its alias are the same, it is said to be called an "implicit" alias. This function will throw if trying the alias is already taken by a node definition (except for implicit aliases) This function will throw if the alias is already in use.
Parameters
aliasName of the alias (instance). May be equal to nodeName.
nodeNameName of the node definition
TextureDefinition* Ogre::TextureDefinitionBase::addTextureDefinition ( const String name)
inherited

Creates a TextureDefinition with a given name, must be unique.

Remarks
WARNING: Calling this function may invalidate all previous returned pointers unless you've properly called setLocalTextureDefinitions
addTextureSourceName remarks for what it can throw
Textures are local when the derived class is a Node definition, and it's global when the derived class is a Workspace definition
Parameters
nameThe name of the texture. Names are usually valid only throughout this node. We need the name, not its hash because we need to validate the global_ prefix is used correctly.
virtual IdString Ogre::TextureDefinitionBase::addTextureSourceName ( const String name,
size_t  index,
TextureSource  textureSource 
)
virtualinherited

Adds a texture name, whether a real one or an alias, and where to grab it from.

Remarks
Throws if a texture with same name already exists, or if the name makes improper usage of the 'global' prefix.
This is a generic way to add input channels, by calling:
addTextureSourceName( "myRT", 0, TextureDefinitionBase::TEXTURE_INPUT );

You're assigning an alias named "myRT" to channel Input #0 For local or global textures, the index parameter documentation

Parameters
fullNameThe name of the texture. Names are usually valid only throughout this node. We need the name, not its hash because we need to validate the global_ prefix is used correctly.
indexIndex in the container where the texture is located, eg. this->mLocalTextureDefs[index] for local textures, workspace->mLocalTextureDefs[index] for global textures, and this->mInTextures[index] for input channels.
textureSourceSource where the index must be used (eg. TEXTURE_LOCAL means mLocalTextureDefs)
Returns
IdString of the fullName paremeter, for convenience

Reimplemented in Ogre::CompositorShadowNodeDef.

void Ogre::CompositorWorkspaceDef::clearAll ( void  )

Clears everything: All node aliases, and their connections (including output connection).

Remarks
This function shouldn't be called while there are still instantiated workspaces It is safe to call this function while there are still workspaces, but you must call ::recreateAllNodes after you're done setting the new node connections.
void Ogre::CompositorWorkspaceDef::clearAllInterNodeConnections ( void  )

Clears all the connection between channels of the nodes (.

See also
connect).
Remarks
  1. We don't clear the output connection (
See also
connectOutput,
clearOutputConnections)
  1. The node aliases (both implicit and explicit) will still exist. clearAll.
  2. A node with incomplete inputs should be disabled before the workspace is instantiated (
CompositorNodeDef::setStartEnabled). If the workspace has already been instantiated, the node instance should be disabled,
CompositorNode::setEnabled)
  1. It is safe to call this function while there are still workspaces, but you must call ::reconnectAllNodes after you're done setting the new node connections
void Ogre::CompositorWorkspaceDef::clearOutputConnections ( void  )

Clears the connection from the "final output RenderTarget" (i.e.

usually the RenderWindow) that goes to the input channel of one of our nodes. connectOutput.

Remarks
  1. We don't clear other type of connections (
See also
connect,
clearAllInterNodeConnections)
  1. The node aliases (both implicit and explicit) will still exist. clearAll.
  2. A node with incomplete inputs should be disabled before the workspace is instantiated (
CompositorNodeDef::setStartEnabled). If the workspace has already been instantiated, the node instance should be disabled,
CompositorNode::setEnabled)
  1. It is safe to call this function while there are still workspaces, but you must call ::reconnectAllNodes after you're done setting the new node connections
void Ogre::CompositorWorkspaceDef::connect ( IdString  outNode,
uint32  outChannel,
IdString  inNode,
uint32  inChannel 
)

Connects outNode's output channel to inNode's input channel.

Remarks
This mapping will later be used to know how connections should be done when instantiating. CompositorNode::connectTo If outNode & inNode are not yet aliased, an alias for them will be created.
void Ogre::CompositorWorkspaceDef::connect ( IdString  outNode,
IdString  inNode 
)

Connects all outputs channels from outNode to all input channels from inNode.

If the number of channels don't match, only the first N channels are set (where N is the minimum between outNode's output channels and inNode's input channels).

Remarks
If outNode & inNode are not yet aliased, an alias for them will be created.
void Ogre::CompositorWorkspaceDef::connectOutput ( IdString  inNode,
uint32  inChannel 
)

Connects the (probably "final") node by passing the RenderWindow in the given input channel.

Remarks
connect Only passing the RenderTarget to one node is supported. If the user wants to use it in more nodes, he can use a dummy node as splitter (gotta love Nodes' flexibility! :)). inNode is not yet aliased, an implicit alias will be created.
void Ogre::CompositorWorkspaceDef::createImplicitAlias ( IdString  nodeName)
protected

Checks if nodeName is already aliased (whether explicitly or implicitly).

If not, checks whether the name of the node corresponds to an actual Node definition. If so, creates the implicit alias; otherwise throws

Remarks
This means it's only safe to pass names that aren't Nodes if it's already been explicitly aliased.
Parameters
Nameof the node definition.
static CompositorChannel Ogre::TextureDefinitionBase::createTexture ( const TextureDefinition textureDef,
const String texName,
const RenderTarget finalTarget,
RenderSystem renderSys 
)
staticinherited
static void Ogre::TextureDefinitionBase::createTextures ( const TextureDefinitionVec textureDefs,
CompositorChannelVec inOutTexContainer,
IdType  id,
bool  uniqueNames,
const RenderTarget finalTarget,
RenderSystem renderSys 
)
staticinherited

Utility function to create the textures based on a given set of texture definitions and put them in a container.

Remarks
Useful because both Workspace & CompositorNode share the same functionality (create global/local textures respectively) without having to create a whole base class just for one function. It's confusing that Nodes & Workspace would share the same base class, as if they were the same base object or share similar functionality (when in fact, workspace manages nodes)
Parameters
textureDefsArray of texture definitions
inOutTexContainerWhere we'll store the newly created RTs & textures
idUnique id in the case we want textures to have unique names (uniqueNames must be true)
uniqueNamesSet to true if each RT will have a unique name based on given Id, or we don't. The latter is useful for global textures (let them get access through materials)
finalTargetThe final render target (usually the render window) we have to clone parameters from (eg. when using auto width & height, or fsaa settings)
renderSysThe RenderSystem to use
static void Ogre::TextureDefinitionBase::decodeTexSource ( uint32  encodedVal,
size_t &  outIdx,
TextureSource outTexSource 
)
staticprotectedinherited
static void Ogre::TextureDefinitionBase::destroyTextures ( CompositorChannelVec inOutTexContainer,
RenderSystem renderSys 
)
staticinherited

createTextures

static uint32 Ogre::TextureDefinitionBase::encodeTexSource ( size_t  index,
TextureSource  textureSource 
)
inlinestaticprotectedinherited

Definition at line 127 of file OgreTextureDefinition.h.

const NodeAliasMap& Ogre::CompositorWorkspaceDef::getNodeAliasMap ( void  )
inline

Gets read-only access to the map to all added nodes and their aliases.

Useful to know which nodes are in use by this compositor. Use and to safely modify the map.

Definition at line 180 of file OgreCompositorWorkspaceDef.h.

size_t Ogre::TextureDefinitionBase::getNumInputChannels ( void  ) const
inherited

This has O(N) complexity! (not cached, we look in mNameToChannelMap)

void Ogre::TextureDefinitionBase::getTextureSource ( IdString  name,
size_t &  index,
TextureSource textureSource 
) const
inherited

Retrieves in which container to look for when looking to which texture is a given name associated with.

Remarks
Throws if name is not found.
Parameters
nameThe name of the texture. Names are usually valid only throughout this node.
index[out] The index at the container in which the texture associated with the output channel is stored
textureSource[out] Where to get this texture from
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.

static void Ogre::TextureDefinitionBase::recreateResizableTextures ( const TextureDefinitionVec textureDefs,
CompositorChannelVec inOutTexContainer,
const RenderTarget finalTarget,
RenderSystem renderSys,
const CompositorNodeVec connectedNodes,
const CompositorPassVec passes 
)
staticinherited

Destroys & recreates only the textures that depend on the main RT (i.e.

the RenderWindow) resolution

Parameters
textureDefsArray of texture definitions, so we know which ones depend on main RT's resolution
inOutTexContainerWhere we'll replace the RTs & textures
finalTargetThe final render target (usually the render window) we have to clone parameters from (eg. when using auto width & height, or fsaa settings)
renderSysThe RenderSystem to use
connectedNodesArray of connected nodes that may be using our textures and need to be notified.
passesArray of Compositor Passes which may contain the texture being recreated When the pointer is null, we don't iterate through it.
void Ogre::CompositorWorkspaceDef::removeNodeAlias ( IdString  alias)

Removes a particular Node.

All of its connections to other node are also removed, which may leave other nodes with its inputs in an incomplete state.

void Ogre::TextureDefinitionBase::setNumLocalTextureDefinitions ( size_t  numTDs)
inlineinherited

Reserves enough memory for all texture definitions.

Remarks
Calling this function is not obligatory, but recommended
Parameters
numPassesThe number of texture definitions expected to contain.

Definition at line 189 of file OgreTextureDefinition.h.

Friends And Related Function Documentation

friend class CompositorWorkspace
friend

Definition at line 57 of file OgreCompositorWorkspaceDef.h.

Member Data Documentation

NodeAliasMap Ogre::CompositorWorkspaceDef::mAliasedNodes
protected

Definition at line 75 of file OgreCompositorWorkspaceDef.h.

ChannelRouteList Ogre::CompositorWorkspaceDef::mChannelRoutes
protected

Definition at line 76 of file OgreCompositorWorkspaceDef.h.

CompositorManager2* Ogre::CompositorWorkspaceDef::mCompositorManager
protected

Alias of the final node to send the RenderWindow to.

Definition at line 81 of file OgreCompositorWorkspaceDef.h.

TextureSource Ogre::TextureDefinitionBase::mDefaultLocalTextureSource
protectedinherited

TextureSource to use by addLocalTextureDefinition.

Could be either TEXTURE_LOCAL or TEXTURE_GLOBAL (depends on our derived class)

Definition at line 119 of file OgreTextureDefinition.h.

uint32 Ogre::CompositorWorkspaceDef::mFinalInChannel
protected

Definition at line 78 of file OgreCompositorWorkspaceDef.h.

IdString Ogre::CompositorWorkspaceDef::mFinalNode
protected

Input Channel # to send the RenderWindow to.

Definition at line 79 of file OgreCompositorWorkspaceDef.h.

TextureDefinitionVec Ogre::TextureDefinitionBase::mLocalTextureDefs
protectedinherited

Definition at line 120 of file OgreTextureDefinition.h.

IdString Ogre::CompositorWorkspaceDef::mName
protected

Definition at line 74 of file OgreCompositorWorkspaceDef.h.

NameToChannelMap Ogre::TextureDefinitionBase::mNameToChannelMap
protectedinherited

Similar to.

See also
CompositorNodeDef::mOutChannelMapping, associates a given name with the input, local or global textures.

Definition at line 125 of file OgreTextureDefinition.h.


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