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

Compositor nodes are the core subject of compositing. More...

#include <OgreCompositorNodeDef.h>

+ Inheritance diagram for Ogre::CompositorNodeDef:

Public Member Functions

 CompositorNodeDef (const String &name, CompositorManager2 *compositorManager)
 
virtual ~CompositorNodeDef ()
 
CompositorTargetDefaddTargetPass (const String &renderTargetName, uint32 rtIndex=0)
 Adds a new Target pass. More...
 
size_t calculateNumPasses () const
 Calculates the total number of passes in this node. More...
 
CompositorManager2getCompositorManager () const
 
IdString getName () const
 
String getNameStr () const
 
size_t getNumOutputChannels () const
 Returns the number of output channels. More...
 
size_t getNumTargetPasses () const
 Gets the number of target passes in this node. More...
 
size_t getPassNumber (const CompositorPassDef *passDef) const
 Returns the pass # of the given pass definition in this node. More...
 
bool getStartEnabled () const
 
CompositorTargetDefgetTargetPass (size_t passIndex)
 Retrieves an existing pass by it's given index. More...
 
void getTextureSource (IdString name, size_t &index, TextureSource &textureSource) const
 See http://www.research.att.com/~bs/bs_faq2.html#overloadderived. More...
 
void getTextureSource (size_t outputChannel, size_t &index, TextureSource &textureSource) const
 Retrieves in which container to look for when wanting to know the output texture using the mappings from input/local texture -> output. More...
 
void mapOutputBufferChannel (size_t outChannel, IdString bufferName)
 Maps the output channel to the given buffer name which can be either a local buffer or a reference to an input channel. More...
 
void mapOutputChannel (size_t outChannel, IdString textureName)
 Maps the output channel to the given texture name, which can be either a local texture or a reference to an input channel. More...
 
virtual void postInitializePassDef (CompositorPassDef *passDef)
 Called right after we create a pass definition. More...
 
void removeTexture (IdString name) override
 WARNING: Be very careful with this function. More...
 
void setNumOutputBufferChannels (size_t numOuts)
 Reserves enough memory for all output channel mappings (efficient allocation, better than using linked lists or other containers with two level of indirections) More...
 
void setNumOutputChannels (size_t numOuts)
 Reserves enough memory for all output channel mappings (efficient allocation, better than using linked lists or other containers with two level of indirections) More...
 
void setNumTargetPass (size_t numPasses)
 Reserves enough memory for all passes. More...
 
void setStartEnabled (bool enabled)
 Whether the node should be start as enabled when instantiated. 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)
 
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...
 

Public Attributes

IdString mCustomIdentifier
 

Additional Inherited Members

- 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 }
 
- 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

Compositor nodes are the core subject of compositing.

They can define local textures and pass them to other nodes within the same workspace through their output channels. They can also receive textures through their input channels and send them through a different output channel to the next node(s). They can access global textures defined by the Workspace they belong to, but can't pass them to the output channels.
How nodes input and output channels are wired together depends on the Workspace (See CompositorWorkspace and CompositorWorkspaceDef) A node cannot receive input from two nodes in the same channel, but it can send output to more than one node using the same output channel.
A node whose workspace didn't connect all of its input channels cannot be executed, and unless it is disabled, the Compositor will be unable to render.
The other core feature of nodes (besides textures and channels) is that they perform passes on RTs. A pass is the basic way to render: it can be a PASS_SCENE, PASS_QUAD, PASS_CLEAR, PASS_STENCIL, PASS_RESOLVE
This is the definition. For the instantiation,
See also
CompositorNode
Remarks
We own the local textures, so it's our job to destroy them
Author
Matias N. Goldberg
Version
1.1

Constructor & Destructor Documentation

◆ CompositorNodeDef()

Ogre::CompositorNodeDef::CompositorNodeDef ( const String name,
CompositorManager2 compositorManager 
)
inline

◆ ~CompositorNodeDef()

virtual Ogre::CompositorNodeDef::~CompositorNodeDef ( )
inlinevirtual

Member Function Documentation

◆ addTargetPass()

CompositorTargetDef* Ogre::CompositorNodeDef::addTargetPass ( const String renderTargetName,
uint32  rtIndex = 0 
)

Adds a new Target pass.

Remarks
WARNING: Calling this function may invalidate all previous returned pointers unless you've properly called setNumTargetPass
Parameters
renderTargetNameWe need the full name, not just the hash; so we can check whether it has the global_ prefix
rtIndexThe RT to address if it is intended to use with a 3D texture (or a cubemap or a 2D Array) See CompositorPassDef::mRtIndex. Default: 0

◆ calculateNumPasses()

size_t Ogre::CompositorNodeDef::calculateNumPasses ( ) const

Calculates the total number of passes in this node.

◆ getCompositorManager()

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

◆ getName()

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

◆ getNameStr()

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

◆ getNumOutputChannels()

size_t Ogre::CompositorNodeDef::getNumOutputChannels ( ) const
inline

Returns the number of output channels.

◆ getNumTargetPasses()

size_t Ogre::CompositorNodeDef::getNumTargetPasses ( ) const
inline

Gets the number of target passes in this node.

◆ getPassNumber()

size_t Ogre::CompositorNodeDef::getPassNumber ( const CompositorPassDef passDef) const

Returns the pass # of the given pass definition in this node.

This operation is O(N). Useful for debug output.

Parameters
passDefThe pass definition to look for
Returns
Value in range [0; total_numer_of_passes_in_this_node) -1 if not found (pass doesn't belong to this node)

◆ getStartEnabled()

bool Ogre::CompositorNodeDef::getStartEnabled ( ) const
inline

◆ getTargetPass()

CompositorTargetDef* Ogre::CompositorNodeDef::getTargetPass ( size_t  passIndex)
inline

Retrieves an existing pass by it's given index.

◆ getTextureSource() [1/2]

void Ogre::TextureDefinitionBase::getTextureSource

◆ getTextureSource() [2/2]

void Ogre::CompositorNodeDef::getTextureSource ( size_t  outputChannel,
size_t &  index,
TextureSource textureSource 
) const

Retrieves in which container to look for when wanting to know the output texture using the mappings from input/local texture -> output.

Parameters
outputChannel[in] The output channel we want to know about
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

◆ mapOutputBufferChannel()

void Ogre::CompositorNodeDef::mapOutputBufferChannel ( size_t  outChannel,
IdString  bufferName 
)

Maps the output channel to the given buffer name which can be either a local buffer or a reference to an input channel.

Global buffers can't be used as output.

Remarks
Don't leave gaps. (i.e. set channel 0 & 2, without setting channel 1) It's ok to map them out of order (i.e. set channel 2, then 0, then 1) Prefer calling
See also
setNumOutputChannels beforehand Will throw if the local texture hasn't been declared yet or the input channel name hasn't been set yet (declaration order is important!).
Parameters
outChannelOutput channel # to map
bufferNameName of the buffer

◆ mapOutputChannel()

void Ogre::CompositorNodeDef::mapOutputChannel ( size_t  outChannel,
IdString  textureName 
)

Maps the output channel to the given texture name, which can be either a local texture or a reference to an input channel.

Global textures can't be used as output.

Remarks
Don't leave gaps. (i.e. set channel 0 & 2, without setting channel 1) It's ok to map them out of order (i.e. set channel 2, then 0, then 1) Prefer calling
See also
setNumOutputChannels beforehand Will throw if the local texture hasn't been declared yet or the input channel name hasn't been set yet (declaration order is important!).
Parameters
outChannelOutput channel # to map
textureNameName of the texture, which can be to a local texture, or an input channel's name. Global textures aren't supported.

◆ postInitializePassDef()

virtual void Ogre::CompositorNodeDef::postInitializePassDef ( CompositorPassDef passDef)
inlinevirtual

Called right after we create a pass definition.

Derived classes may want to do something with it

Parameters
passDefNewly created pass to toy with.

Reimplemented in Ogre::CompositorShadowNodeDef.

◆ removeTexture()

void Ogre::CompositorNodeDef::removeTexture ( IdString  name)
overridevirtual

WARNING: Be very careful with this function.

Removes a texture.

  • If the texture is from an input channel (TEXTURE_INPUT), the input channel is removed.
  • If the texture is a local definition (TEXTURE_LOCAL) the texture definition is removed and all the references to mLocalTextureDefs[i+1] ... mLocalTextureDefs[i+n] are updated. However, the output channels will now contain an invalid index and will only be removed if it was the last output channel (since we can't alter the order). It is your responsability to call CompositorNodeDef::mapOutputChannel again with a valid texture name to the channel it was occupying.
  • If the texture is a global texture (TEXTURE_GLOBAL), the global texture can no longer be accessed until addTextureSourceName( name, 0, TEXTURE_GLOBAL ) is called again.
    Parameters
    nameName of the texture to remove.

Reimplemented from Ogre::TextureDefinitionBase.

◆ setNumOutputBufferChannels()

void Ogre::CompositorNodeDef::setNumOutputBufferChannels ( size_t  numOuts)
inline

Reserves enough memory for all output channel mappings (efficient allocation, better than using linked lists or other containers with two level of indirections)

Remarks
Calling this function is not obligatory, but recommended
Parameters
numOutsThe number of output buffer channels expected to contain.

◆ setNumOutputChannels()

void Ogre::CompositorNodeDef::setNumOutputChannels ( size_t  numOuts)
inline

Reserves enough memory for all output channel mappings (efficient allocation, better than using linked lists or other containers with two level of indirections)

Remarks
Calling this function is not obligatory, but recommended
Parameters
numOutsThe number of output channels expected to contain.

◆ setNumTargetPass()

void Ogre::CompositorNodeDef::setNumTargetPass ( size_t  numPasses)
inline

Reserves enough memory for all passes.

Remarks
Calling this function is obligatory, otherwise unexpected crashes may occur. CompositorTargetDef doesn't follow the Rule of Three.
Parameters
numPassesThe number of passes expected to contain.

◆ setStartEnabled()

void Ogre::CompositorNodeDef::setStartEnabled ( bool  enabled)
inline

Whether the node should be start as enabled when instantiated.

Member Data Documentation

◆ mCustomIdentifier

IdString Ogre::CompositorNodeDef::mCustomIdentifier

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