xyginext  0.2.0
Second generation of xygine game creation framework
Public Types | Public Member Functions | Protected Member Functions | Static Protected Member Functions | List of all members
xy::PostProcess Class Referenceabstract

Abstract base class for full screen post processes. More...

#include <PostProcess.hpp>

Inheritance diagram for xy::PostProcess:
xy::PostAntique xy::PostBloom xy::PostBlur xy::PostChromeAb xy::PostOldSchool

Public Types

using Ptr = std::unique_ptr< PostProcess >
 

Public Member Functions

 PostProcess (const PostProcess &)=delete
 
 PostProcess (PostProcess &&)=delete
 
PostProcessoperator= (const PostProcess &)=delete
 
PostProcessoperator= (PostProcess &&)=delete
 
virtual void apply (const sf::RenderTexture &, sf::RenderTarget &)=0
 Applies the effect. More...
 
virtual void update (float)
 Updates the effect. Some effects may require shader parameters to be updated over time. This optionally overridable function passes in the current frame time and allows updating those parameters. This is called automatically when the effect is added to a Scene, but will need to be called manually when using the effect on its own.
 
void resizeBuffer (sf::Int32 w, sf::Int32 h)
 

Protected Member Functions

virtual void bufferResized ()
 Called when the main output buffer resized. Implement this in post processes which contain intermediate buffers which need to be updated.
 
sf::Vector2i getBufferSize () const
 Returns the current buffer size.
 

Static Protected Member Functions

static void applyShader (const sf::Shader &, sf::RenderTarget &)
 

Detailed Description

Abstract base class for full screen post processes.

Post processes can be added to a scene so that they are applied after a scene is rendered. Multiple post processes can be chained but be aware that too many will affect performance.

Member Function Documentation

◆ apply()

virtual void xy::PostProcess::apply ( const sf::RenderTexture &  ,
sf::RenderTarget &   
)
pure virtual

Applies the effect.

Parameters
RenderTextureA render Texture containing the scene to which the effect should be applied.
RenderTargetThe target to which the effected scene is rendered. This may be the current render window, or another RenderTexture when chaining multiple effects together.

The source and destinations are handled automatically by xygine when a post process effect is added to a scene, but must be specified maunally when using the effect outside the scene rendering.

Implemented in xy::PostChromeAb, xy::PostBloom, xy::PostBlur, xy::PostAntique, and xy::PostOldSchool.