OGRE: Ogre::CompositorInstance Class Reference

| OGRE 14.5 Object-Oriented Graphics Rendering Engine

Loading...
Searching...
No Matches
Ogre::CompositorInstance Class Reference
Core » Effects

An instance of a Compositor object for one Viewport. More...

`#include <OgreCompositorInstance.h>`

Inheritance diagram for Ogre::CompositorInstance:
[legend]

## Classes
class | Listener
| Provides an interface to "listen in" to to render system operations executed by this CompositorInstance. More...
class | RenderSystemOperation
| Specific render system operation. More...
class | TargetOperation
| Operation setup for a RenderTarget (collected). More...

## Public Types
typedef std::vector< TargetOperation > | CompiledState
typedef std::pair< int, RenderSystemOperation * > | RenderSystemOpPair
typedef std::vector< RenderSystemOpPair > | RenderSystemOpPairs

## Public Member Functions
| CompositorInstance (CompositionTechnique *technique, CompositorChain *chain)
virtual | ~CompositorInstance ()
virtual void | _compileOutputOperation (TargetOperation &finalState)
| Compile the final (output) operation.
virtual void | _compileTargetOperations (CompiledState &compiledState)
| Recursively collect target states (except for final Pass).
void | _fireNotifyMaterialRender (uint32 pass_id, MaterialPtr &mat)
| Notify listeners of a material render.
void | _fireNotifyMaterialSetup (uint32 pass_id, MaterialPtr &mat)
| Notify listeners of a material compilation.
void | _fireNotifyResourcesCreated (bool forResizeOnly)
| Notify listeners of a material render.
void | _fireNotifyResourcesReleased (bool forResizeOnly)
| Notify listeners resources.
void | addListener (Listener *l)
| Add a listener.
bool | getAlive () const
| Get alive flag.
CompositorChain * | getChain ()
| Get Chain that this instance is part of.
Compositor * | getCompositor () const
| Get Compositor of which this is an instance.
bool | getEnabled () const
| Get enabled flag.
RenderTarget * | getRenderTarget (const String &name, int slice=0)
| Get the render target for a given render texture name.
const String & | getScheme () const
| Returns the name of the scheme this compositor is using.
CompositionTechnique * | getTechnique () const
| Get CompositionTechnique used by this instance.
const TexturePtr & | getTextureInstance (const String &name, size_t mrtIndex)
| Get the instance of a local texture.
const String & | getTextureInstanceName (const String &name, size_t mrtIndex)
| Get the instance name for a local texture.
void | notifyResized ()
| Notify this instance that the primary surface has been resized.
void | removeListener (Listener *l)
| Remove a listener.
void | setAlive (bool value)
| Set alive/active flag.
void | setEnabled (bool value)
| Set enabled flag.
void | setScheme (const String &schemeName, bool reuseTextures=true)
| Pick a technique to use to render this compositor based on a scheme.
void | setTechnique (CompositionTechnique *tech, bool reuseTextures=true)
| Change the technique we're using to render this compositor.

## Detailed Description

An instance of a Compositor object for one Viewport.

It is part of the CompositorChain for a Viewport.

## Member Typedef Documentation

## ◆ RenderSystemOpPair

typedef std::pair<int, RenderSystemOperation*> Ogre::CompositorInstance::RenderSystemOpPair

## ◆ RenderSystemOpPairs

typedef std::vector<RenderSystemOpPair> Ogre::CompositorInstance::RenderSystemOpPairs

## ◆ CompiledState

typedef std::vector<TargetOperation> Ogre::CompositorInstance::CompiledState

## Constructor & Destructor Documentation

## ◆ CompositorInstance()

Ogre::CompositorInstance::CompositorInstance | ( | CompositionTechnique * | technique,
|  | CompositorChain * | chain )

References CompositorChain.

Referenced by _fireNotifyResourcesReleased().

## ◆ ~CompositorInstance()

virtual Ogre::CompositorInstance::~CompositorInstance | ( |  | ) |
| virtual

## Member Function Documentation

## ◆ setEnabled()

void Ogre::CompositorInstance::setEnabled | ( | bool | value | ) |

Set enabled flag.

The compositor instance will only render if it is enabled, otherwise it is pass-through. Resources are only created if they weren't alive when enabling.

## ◆ getEnabled()

bool Ogre::CompositorInstance::getEnabled | ( |  | ) | const
| inline

Get enabled flag.

## ◆ setAlive()

void Ogre::CompositorInstance::setAlive | ( | bool | value | ) |

Set alive/active flag.

The compositor instance will create resources when alive, and destroy them when inactive.

Killing an instance means also disabling it: setAlive(false) implies setEnabled(false)

## ◆ getAlive()

bool Ogre::CompositorInstance::getAlive | ( |  | ) | const
| inline

Get alive flag.

## ◆ getTextureInstanceName()

const String & Ogre::CompositorInstance::getTextureInstanceName | ( | const String & | name,
|  | size_t | mrtIndex )

Get the instance name for a local texture.

Note
  It is only valid to call this when local textures have been loaded, which in practice means that the compositor instance is active. Calling it at other times will cause an exception. Note that since textures are cleaned up aggressively, this name is not guaranteed to stay the same if you disable and re-enable the compositor instance.

Parameters

  name | The name of the texture in the original compositor definition.
  mrtIndex | If name identifies a MRT, which texture attachment to retrieve.

Returns
  The instance name for the texture, corresponds to a real texture.

## ◆ getTextureInstance()

const TexturePtr & Ogre::CompositorInstance::getTextureInstance | ( | const String & | name,
|  | size_t | mrtIndex )

Get the instance of a local texture.

Note
  Textures are only valid when local textures have been loaded, which in practice means that the compositor instance is active. Calling this method at other times will return null pointers. Note that since textures are cleaned up aggressively, this pointer is not guaranteed to stay the same if you disable and re-enable the compositor instance.

Parameters

  name | The name of the texture in the original compositor definition.
  mrtIndex | If name identifies a MRT, which texture attachment to retrieve.

Returns
  The texture pointer, corresponds to a real texture.

## ◆ getRenderTarget()

RenderTarget * Ogre::CompositorInstance::getRenderTarget | ( | const String & | name,
|  | int | slice = 0 )

Get the render target for a given render texture name.

You can use this to add listeners etc, but do not use it to update the targets manually or any other modifications, the compositor instance is in charge of this.

## ◆ _compileTargetOperations()

virtual void Ogre::CompositorInstance::_compileTargetOperations | ( | CompiledState & | compiledState | ) |
| virtual

Recursively collect target states (except for final Pass).

Parameters

  compiledState | This vector will contain a list of TargetOperation objects.

## ◆ _compileOutputOperation()

virtual void Ogre::CompositorInstance::_compileOutputOperation | ( | TargetOperation & | finalState | ) |
| virtual

Compile the final (output) operation.

This is done separately because this is combined with the input in chained filters.

## ◆ getCompositor()

Compositor * Ogre::CompositorInstance::getCompositor | ( |  | ) | const
| inline

Get Compositor of which this is an instance.

References Compositor.

## ◆ getTechnique()

CompositionTechnique * Ogre::CompositorInstance::getTechnique | ( |  | ) | const
| inline

Get CompositionTechnique used by this instance.

## ◆ setTechnique()

void Ogre::CompositorInstance::setTechnique | ( | CompositionTechnique * | tech,
|  | bool | reuseTextures = true )

Change the technique we're using to render this compositor.

Parameters

  tech | The technique to use (must be supported and from the same Compositor)
  reuseTextures | If textures have already been created for the current technique, whether to try to re-use them if sizes & formats match.

## ◆ setScheme()

void Ogre::CompositorInstance::setScheme | ( | const String & | schemeName,
|  | bool | reuseTextures = true )

Pick a technique to use to render this compositor based on a scheme.

If there is no specific supported technique with this scheme name, then the first supported technique with no specific scheme will be used.

See also
  CompositionTechnique::setSchemeName

Parameters

  schemeName | The scheme to use
  reuseTextures | If textures have already been created for the current technique, whether to try to re-use them if sizes & formats match. Note that for this feature to be of benefit, the textures must have been created with the 'pooled' option enabled.

## ◆ getScheme()

const String & Ogre::CompositorInstance::getScheme | ( |  | ) | const
| inline

Returns the name of the scheme this compositor is using.

References Ogre::BLANKSTRING.

## ◆ notifyResized()

void Ogre::CompositorInstance::notifyResized | ( |  | ) |

Notify this instance that the primary surface has been resized.

This will allow the instance to recreate its resources that are dependent on the size.

## ◆ getChain()

CompositorChain * Ogre::CompositorInstance::getChain | ( |  | ) |

Get Chain that this instance is part of.

References CompositorChain.

## ◆ addListener()

void Ogre::CompositorInstance::addListener | ( | Listener * | l | ) |

Add a listener.

Listeners provide an interface to "listen in" to to render system operations executed by this CompositorInstance so that materials can be programmatically set up.

See also
  CompositorInstance::Listener

## ◆ removeListener()

void Ogre::CompositorInstance::removeListener | ( | Listener * | l | ) |

Remove a listener.

See also
  CompositorInstance::Listener

## ◆ _fireNotifyMaterialSetup()

void Ogre::CompositorInstance::_fireNotifyMaterialSetup | ( | uint32 | pass_id,
|  | MaterialPtr & | mat )

Notify listeners of a material compilation.

## ◆ _fireNotifyMaterialRender()

void Ogre::CompositorInstance::_fireNotifyMaterialRender | ( | uint32 | pass_id,
|  | MaterialPtr & | mat )

Notify listeners of a material render.

## ◆ _fireNotifyResourcesCreated()

void Ogre::CompositorInstance::_fireNotifyResourcesCreated | ( | bool | forResizeOnly | ) |

Notify listeners of a material render.

## ◆ _fireNotifyResourcesReleased()

void Ogre::CompositorInstance::_fireNotifyResourcesReleased | ( | bool | forResizeOnly | ) |

Notify listeners resources.

References CompositorInstance(), Compositor, and CompositorChain.

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

- OgreCompositorInstance.h