OGRE  1.10.12
Object-Oriented Graphics Rendering Engine
Ogre::CompositorInstance Class Reference

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

#include <OgreCompositorInstance.h>

+ Inheritance diagram for Ogre::CompositorInstance:

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 vector< TargetOperation >::type CompiledState
 
typedef map< int, MaterialPtr >::type QuadMaterialMap
 
typedef std::pair< int, RenderSystemOperation * > RenderSystemOpPair
 
typedef vector< RenderSystemOpPair >::type RenderSystemOpPairs
 

Public Member Functions

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

Friends

class CompositorChain
 

Detailed Description

An instance of a Compositor object for one Viewport.

It is part of the CompositorChain for a Viewport.

Member Typedef Documentation

◆ QuadMaterialMap

◆ RenderSystemOpPair

◆ RenderSystemOpPairs

◆ CompiledState

Constructor & Destructor Documentation

◆ CompositorInstance()

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

◆ ~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.

Remarks
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
nameThe name of the texture in the original compositor definition.
mrtIndexIf name identifies a MRT, which texture attachment to retrieve.
Returns
The instance name for the texture, corresponds to a real texture.

◆ getTextureInstance()

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
nameThe name of the texture in the original compositor definition.
mrtIndexIf 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)

Get the render target for a given render texture name.

Remarks
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
compiledStateThis 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 ( )

Get Compositor of which this is an instance.

◆ getTechnique()

CompositionTechnique* Ogre::CompositorInstance::getTechnique ( )

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
techThe technique to use (must be supported and from the same Compositor)
reuseTexturesIf 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.

Remarks
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
schemeNameThe scheme to use
reuseTexturesIf 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.

Remarks
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.

◆ 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 ressources.

Friends And Related Function Documentation

◆ CompositorChain

friend class CompositorChain
friend

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