OGRE-Next  3.0.0unstable
Object-Oriented Graphics Rendering Engine
Ogre::CompositorWorkspaceDef Class Reference

#include <OgreCompositorWorkspaceDef.h>

+ Inheritance diagram for Ogre::CompositorWorkspaceDef:

Classes

struct  ChannelRoute
 

Public Types

typedef list< ChannelRoute >::type ChannelRouteList
 
typedef map< IdString, IdString >::type NodeAliasMap
 
- Public Types inherited from Ogre::TextureDefinitionBase
typedef vector< BufferDefinition >::type BufferDefinitionVec
 
typedef vector< PixelFormatGpu >::type PixelFormatGpuVec
 
typedef vector< TextureDefinition >::type TextureDefinitionVec
 
enum  TextureSource { TEXTURE_INPUT , TEXTURE_LOCAL , TEXTURE_GLOBAL , NUM_TEXTURES_SOURCES }
 

Public Member Functions

 CompositorWorkspaceDef (const String &name, CompositorManager2 *compositorManager)
 
virtual ~CompositorWorkspaceDef ()
 
ChannelRouteList_getChannelRoutes ()
 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...
 
void clearAll ()
 Clears everything: All node aliases, and their connections (including output connection). More...
 
void clearAllInterNodeConnections ()
 Clears all the connection between channels of the nodes. More...
 
void clearOutputConnections ()
 Clears the connection from the "final output RenderTarget" (i.e. More...
 
void connect (IdString outNode, IdString inNode)
 Connects all outputs channels from outNode to all input channels from inNode. More...
 
void connect (IdString outNode, uint32 outChannel, IdString inNode, uint32 inChannel)
 Connects outNode's output channel to inNode's input channel. More...
 
void connectBuffer (IdString outNode, IdString inNode)
 Connects all output buffer channels from outNode to all input buffer channels from inNode. More...
 
void connectBuffer (IdString outNode, uint32 outChannel, IdString inNode, uint32 inChannel)
 Connects outNode's output buffer channel to inNode's input buffer channel. More...
 
void connectExternal (uint32 externalIdx, IdString inNode, uint32 inChannel)
 Connects the (probably "final") node by passing the RenderWindow in the given input channel. More...
 
void connectExternalBuffer (uint32 externalBufferIdx, IdString inNode, uint32 inChannel)
 Connects an external buffer to the given input channel. More...
 
CompositorManager2getCompositorManager () const
 
IdString getName () const
 
String getNameStr () const
 
const NodeAliasMapgetNodeAliasMap ()
 Gets read-only access to the map to all added nodes and their aliases. More...
 
void removeNodeAlias (IdString alias)
 Removes a particular Node. More...
 
- Public Member Functions inherited from Ogre::TextureDefinitionBase
 TextureDefinitionBase (TextureSource defaultSource)
 
void addBufferDefinition (IdString name, size_t numElements, uint32 bytesPerElement, uint32 bindFlags, float widthFactor, float heightFactor)
 Creates an UAV buffer. More...
 
virtual void addBufferInput (size_t inputChannel, IdString name)
 Buffers. More...
 
RenderTargetViewDefaddRenderTextureView (IdString name)
 
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...
 
const BufferDefinitionVecgetLocalBufferDefinitions () const
 
BufferDefinitionVecgetLocalBufferDefinitionsNonConst ()
 Returns the local buffer definitions. More...
 
const TextureDefinitionVecgetLocalTextureDefinitions () const
 
TextureDefinitionVecgetLocalTextureDefinitionsNonConst ()
 Returns the local texture definitions. More...
 
const NameToChannelMap & getNameToChannelMap () const
 
size_t getNumInputBufferChannels () const
 
size_t getNumInputChannels () const
 This has O(N) complexity! (not cached, we look in mNameToChannelMap) More...
 
const RenderTargetViewDefgetRenderTargetViewDef (IdString name) const
 
RenderTargetViewDefgetRenderTargetViewDefNonConstNoThrow (IdString name)
 
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 removeAllRenderTextureViews ()
 
virtual void removeBuffer (IdString name)
 Remove a buffer. Buffer can come from an input channel, or a locally defined one. More...
 
void removeRenderTextureView (IdString name)
 
virtual void removeTexture (IdString name)
 WARNING: Be very careful with this function. More...
 
void renameBuffer (IdString oldName, const String &newName)
 Changes the name of a buffer. More...
 
void renameTexture (IdString oldName, const String &newName)
 Changes the name of a texture. More...
 
void setNumLocalBufferDefinitions (size_t numTDs)
 Reserves enough memory for all texture definitions. More...
 
void setNumLocalTextureDefinitions (size_t numTDs)
 Reserves enough memory for all texture definitions. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Ogre::TextureDefinitionBase
static UavBufferPackedcreateBuffer (const BufferDefinition &bufferDef, const TextureGpu *finalTarget, VaoManager *vaoManager)
 
static void createBuffers (const BufferDefinitionVec &bufferDefs, CompositorNamedBufferVec &inOutBufContainer, const TextureGpu *finalTarget, RenderSystem *renderSys)
 Utility function to create the buffers based on a given set of buffer definitions and put them in a container. More...
 
static CompositorChannel createTexture (const TextureDefinition &textureDef, const String &texName, const TextureGpu *finalTarget, RenderSystem *renderSys)
 
static void createTextures (const TextureDefinitionVec &textureDefs, CompositorChannelVec &inOutTexContainer, IdType id, const TextureGpu *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 destroyBuffers (const BufferDefinitionVec &bufferDefs, CompositorNamedBufferVec &inOutBufContainer, RenderSystem *renderSys)
 
static void destroyTextures (CompositorChannelVec &inOutTexContainer, RenderSystem *renderSys)
 
static void recreateResizableBuffers (const BufferDefinitionVec &bufferDefs, CompositorNamedBufferVec &inOutBufContainer, const TextureGpu *finalTarget, RenderSystem *renderSys, const CompositorNodeVec &connectedNodes, const CompositorPassVec *passes)
 Destroys & recreates only the buffers that depend on the main RT (i.e. More...
 
static void recreateResizableTextures01 (const TextureDefinitionVec &textureDefs, CompositorChannelVec &inOutTexContainer, const TextureGpu *finalTarget)
 Destroys & recreates only the textures that depend on the main RT (e.g. More...
 
static void recreateResizableTextures02 (const TextureDefinitionVec &textureDefs, CompositorChannelVec &inOutTexContainer, const CompositorNodeVec &connectedNodes, const CompositorPassVec *passes)
 See recreateResizableTextures01 Updates involved RenderPassDescriptors. More...
 
static void setupTexture (TextureGpu *tex, const TextureDefinition &textureDef, const TextureGpu *finalTarget)
 

Detailed Description

See also
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

Member Typedef Documentation

◆ ChannelRouteList

◆ NodeAliasMap

Constructor & Destructor Documentation

◆ CompositorWorkspaceDef()

Ogre::CompositorWorkspaceDef::CompositorWorkspaceDef ( const String name,
CompositorManager2 compositorManager 
)

◆ ~CompositorWorkspaceDef()

virtual Ogre::CompositorWorkspaceDef::~CompositorWorkspaceDef ( )
inlinevirtual

Member Function Documentation

◆ _getChannelRoutes()

ChannelRouteList& Ogre::CompositorWorkspaceDef::_getChannelRoutes ( )
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.

◆ addNodeAlias()

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

◆ clearAll()

void Ogre::CompositorWorkspaceDef::clearAll ( )

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 CompositorWorkspace:recreateAllNodes after you're done setting the new node connections.

◆ clearAllInterNodeConnections()

void Ogre::CompositorWorkspaceDef::clearAllInterNodeConnections ( )

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.
  1. 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 CompositorWorkspace::reconnectAllNodes after you're done setting the new node connections

◆ clearOutputConnections()

void Ogre::CompositorWorkspaceDef::clearOutputConnections ( )

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

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

See also
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.
  1. 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 CompositorWorkspace::reconnectAllNodes after you're done setting the new node connections

◆ connect() [1/2]

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.

◆ connect() [2/2]

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.
See also
CompositorNode::connectTo If outNode & inNode are not yet aliased, an alias for them will be created.

◆ connectBuffer() [1/2]

void Ogre::CompositorWorkspaceDef::connectBuffer ( IdString  outNode,
IdString  inNode 
)

Connects all output buffer channels from outNode to all input buffer 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.

◆ connectBuffer() [2/2]

void Ogre::CompositorWorkspaceDef::connectBuffer ( IdString  outNode,
uint32  outChannel,
IdString  inNode,
uint32  inChannel 
)

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

Remarks
This mapping will later be used to know how connections should be done when instantiating.
See also
CompositorNode::connectBufferTo If outNode & inNode are not yet aliased, an alias for them will be created.

◆ connectExternal()

void Ogre::CompositorWorkspaceDef::connectExternal ( uint32  externalIdx,
IdString  inNode,
uint32  inChannel 
)

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

Remarks
See also
connect inNode is not yet aliased, an implicit alias will be created.

◆ connectExternalBuffer()

void Ogre::CompositorWorkspaceDef::connectExternalBuffer ( uint32  externalBufferIdx,
IdString  inNode,
uint32  inChannel 
)

Connects an external buffer to the given input channel.

Remarks
If inNode is not yet aliased, an implicit alias will be created.

◆ getCompositorManager()

CompositorManager2* Ogre::CompositorWorkspaceDef::getCompositorManager ( ) const
inline

◆ getName()

IdString Ogre::CompositorWorkspaceDef::getName ( ) const
inline

◆ getNameStr()

String Ogre::CompositorWorkspaceDef::getNameStr ( ) const
inline

◆ getNodeAliasMap()

const NodeAliasMap& Ogre::CompositorWorkspaceDef::getNodeAliasMap ( )
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 addNodeAlias() removeNodeAlias() and connect() to safely modify the map.

◆ removeNodeAlias()

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.


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