OpenWalnut  1.5.0dev
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Private Attributes | Static Private Attributes | List of all members
WGEPostprocessor Class Referenceabstract

The base class for all custom post-processors. More...

#include <WGEPostprocessor.h>

+ Inheritance diagram for WGEPostprocessor:
+ Collaboration diagram for WGEPostprocessor:

Classes

class  PostprocessorInput
 This class encapsulates a G-Buffer. More...
 

Public Types

typedef std::shared_ptr< WGEPostprocessorSPtr
 Convenience typedef for an osg::ref_ptr< WGEPostprocessor >. More...
 
typedef std::shared_ptr< const WGEPostprocessorConstSPtr
 Convenience typedef for an osg::ref_ptr< const WGEPostprocessor >. More...
 
typedef std::vector< WGEPostprocessor::SPtrProcessorList
 Type used for returning lists of postprocessor prototypes. More...
 

Public Member Functions

 WGEPostprocessor (std::string name, std::string description)
 Create named prototype. More...
 
virtual ~WGEPostprocessor ()
 Destructor. More...
 
virtual SPtr create (osg::ref_ptr< WGEOffscreenRenderNode > offscreen, const PostprocessorInput &gbuffer) const =0
 Create instance. More...
 
virtual WPropGroup getProperties () const
 Returns the set of properties controlling the post-processing node. More...
 
virtual osg::ref_ptr< osg::Texture2D > getOutput (size_t idx=0) const
 Returns the result texture. More...
 
const std::vector< osg::ref_ptr< osg::Texture2D > > & getOutputList () const
 This processor can produce multiple outputs. More...
 
virtual osg::ref_ptr< osg::Texture2D > getDepth () const
 Returns the new depth texture. More...
 
virtual const std::string getName () const
 Gets the name of this postprocessor. More...
 
virtual const std::string getDescription () const
 Gets the description for this postprocessor. More...
 
virtual bool getFixedViewportSize () const
 When this returns true, the viewport size is fixed to the size of the target texture. More...
 
- Public Member Functions inherited from WPrototyped
 WPrototyped ()
 Default constructor. More...
 
virtual ~WPrototyped ()
 Destructor. More...
 
template<typename T >
bool isA ()
 Checks whether the actual prototype has the specified runtime type. More...
 

Static Public Member Functions

static ProcessorList getPostprocessors ()
 Returns a list of all known postprocessor prototypes. More...
 
static void initPostprocessors ()
 Needs to be called prior to any "getPostprocessors" call. More...
 
static size_t addPostprocessor (SPtr processor)
 Allows adding a postprocessor. More...
 

Protected Attributes

std::vector< osg::ref_ptr< osg::Texture2D > > m_resultTextures
 The textures contain the result. More...
 
osg::ref_ptr< osg::Texture2D > m_depthTexture
 The texture contains the new depth. More...
 
WPropGroup m_properties
 All the properties of the post-processor. More...
 
WPropBool m_effectOnly
 A flag denoting whether the effect should be combined with color or not. More...
 
WPropDouble m_effectScale
 Scale the effect prior to blending it. More...
 
WGEShaderPreprocessor::SPtr m_effectOnlyPreprocessor
 For convenience, this is a shader preprocessor controlled by m_effectOnly property. More...
 

Private Attributes

std::string m_name
 Name string. More...
 
std::string m_description
 Description string. More...
 

Static Private Attributes

static ProcessorList m_postProcessors
 List of all postprocessors. More...
 

Detailed Description

The base class for all custom post-processors.

It allows building an own texture processing pipeline for special processings.

Definition at line 48 of file WGEPostprocessor.h.

Member Typedef Documentation

◆ ConstSPtr

typedef std::shared_ptr< const WGEPostprocessor > WGEPostprocessor::ConstSPtr

Convenience typedef for an osg::ref_ptr< const WGEPostprocessor >.

Definition at line 137 of file WGEPostprocessor.h.

◆ ProcessorList

Type used for returning lists of postprocessor prototypes.

Definition at line 142 of file WGEPostprocessor.h.

◆ SPtr

typedef std::shared_ptr< WGEPostprocessor > WGEPostprocessor::SPtr

Convenience typedef for an osg::ref_ptr< WGEPostprocessor >.

Definition at line 132 of file WGEPostprocessor.h.

Constructor & Destructor Documentation

◆ WGEPostprocessor()

WGEPostprocessor::WGEPostprocessor ( std::string  name,
std::string  description 
)

Create named prototype.

You should call this in your prototype constructor.

Parameters
namename of processor
descriptiondescription.

Definition at line 39 of file WGEPostprocessor.cpp.

References m_effectOnly, m_effectOnlyPreprocessor, m_effectScale, and m_properties.

◆ ~WGEPostprocessor()

WGEPostprocessor::~WGEPostprocessor ( )
virtual

Destructor.

Definition at line 61 of file WGEPostprocessor.cpp.

Member Function Documentation

◆ addPostprocessor()

size_t WGEPostprocessor::addPostprocessor ( SPtr  processor)
static

Allows adding a postprocessor.

After this call, everyone using the WGEPostprocessor can utilize your addded postproc.

Parameters
processorthe postprocessor to add
Returns
the index of the newly added postprocessor.

Definition at line 167 of file WGEPostprocessor.cpp.

References m_postProcessors.

◆ create()

virtual SPtr WGEPostprocessor::create ( osg::ref_ptr< WGEOffscreenRenderNode offscreen,
const PostprocessorInput gbuffer 
) const
pure virtual

Create instance.

Uses the protected constructor. Implement it if you derive from this class! This is called whenever your postprocessor is applied to the standard render-output. You can add your own constructors and creators for other cases.

Parameters
offscreenuse this offscreen node to add your texture pass'
gbufferthe input textures you should use
Returns
shared pointer to the created instance

Implemented in WGEPostprocessorSSAO, WGEPostprocessorMergeOp, WGEPostprocessorLineAO, WGEPostprocessorHalftone, WGEPostprocessorGauss, WGEPostprocessorEdgeEnhance, and WGEPostprocessorCelShading.

◆ getDepth()

osg::ref_ptr< osg::Texture2D > WGEPostprocessor::getDepth ( ) const
virtual

Returns the new depth texture.

Allows you to modify the depth values. By default, this is NULL. Check this!

Returns
the depth texture

Definition at line 81 of file WGEPostprocessor.cpp.

References m_depthTexture.

◆ getDescription()

const std::string WGEPostprocessor::getDescription ( ) const
virtual

Gets the description for this postprocessor.

Returns
the description

Implements WPrototyped.

Definition at line 178 of file WGEPostprocessor.cpp.

References m_description.

◆ getFixedViewportSize()

bool WGEPostprocessor::getFixedViewportSize ( ) const
virtual

When this returns true, the viewport size is fixed to the size of the target texture.

This is very useful if you want to process high resolution images offscreen. You can implement this function in your postprocessor to modify this. Please be aware that this does not modify the camera's projection matrix. This is especially important for correct aspect ratios. You can modify the camera dynamically by using callbacks.

Returns
true if fixed.

Definition at line 183 of file WGEPostprocessor.cpp.

◆ getName()

const std::string WGEPostprocessor::getName ( ) const
virtual

Gets the name of this postprocessor.

Returns
the name.

Implements WPrototyped.

Definition at line 173 of file WGEPostprocessor.cpp.

References m_name.

◆ getOutput()

osg::ref_ptr< osg::Texture2D > WGEPostprocessor::getOutput ( size_t  idx = 0) const
virtual

Returns the result texture.

Use this to continue processing.

Parameters
idxwhich output. Each postprocessor returns at least one texture in index 0, which also is the default value
Returns
the result texture

Definition at line 71 of file WGEPostprocessor.cpp.

References m_resultTextures.

◆ getOutputList()

const std::vector< osg::ref_ptr< osg::Texture2D > > & WGEPostprocessor::getOutputList ( ) const

This processor can produce multiple outputs.

Grab them here. This vector always contains at least the first filtered texture in unit 0.

Returns
the vector as copy.

Definition at line 76 of file WGEPostprocessor.cpp.

References m_resultTextures.

◆ getPostprocessors()

WGEPostprocessor::ProcessorList WGEPostprocessor::getPostprocessors ( )
static

Returns a list of all known postprocessor prototypes.

Returns
the list

Definition at line 151 of file WGEPostprocessor.cpp.

References m_postProcessors.

Referenced by WGEPostprocessingNode::WGEPostprocessingNode().

+ Here is the caller graph for this function:

◆ getProperties()

WPropGroup WGEPostprocessor::getProperties ( ) const
virtual

Returns the set of properties controlling the post-processing node.

You can use them to provide them to the user for example.

Returns
the properties as a group.

Definition at line 66 of file WGEPostprocessor.cpp.

References m_properties.

◆ initPostprocessors()

void WGEPostprocessor::initPostprocessors ( )
static

Needs to be called prior to any "getPostprocessors" call.

Needed for initialization. This is done by WGraphicsEngine.

Definition at line 156 of file WGEPostprocessor.cpp.

References m_postProcessors.

Referenced by WGraphicsEngine::threadMain().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_depthTexture

osg::ref_ptr< osg::Texture2D > WGEPostprocessor::m_depthTexture
protected

The texture contains the new depth.

Definition at line 251 of file WGEPostprocessor.h.

Referenced by WGEPostprocessor::PostprocessorInput::bind(), getDepth(), and WGEPostprocessor::PostprocessorInput::PostprocessorInput().

◆ m_description

std::string WGEPostprocessor::m_description
private

Description string.

Set by the constructor.

Definition at line 281 of file WGEPostprocessor.h.

Referenced by getDescription().

◆ m_effectOnly

WPropBool WGEPostprocessor::m_effectOnly
protected

A flag denoting whether the effect should be combined with color or not.

Definition at line 261 of file WGEPostprocessor.h.

Referenced by WGEPostprocessor(), and WGEPostprocessorCelShading::WGEPostprocessorCelShading().

◆ m_effectOnlyPreprocessor

WGEShaderPreprocessor::SPtr WGEPostprocessor::m_effectOnlyPreprocessor
protected

◆ m_effectScale

WPropDouble WGEPostprocessor::m_effectScale
protected

Scale the effect prior to blending it.

Definition at line 266 of file WGEPostprocessor.h.

Referenced by WGEPostprocessor(), WGEPostprocessorHalftone::WGEPostprocessorHalftone(), and WGEPostprocessorLineAO::WGEPostprocessorLineAO().

◆ m_name

std::string WGEPostprocessor::m_name
private

Name string.

Set by the constructor.

Definition at line 276 of file WGEPostprocessor.h.

Referenced by getName().

◆ m_postProcessors

WGEPostprocessor::ProcessorList WGEPostprocessor::m_postProcessors
staticprivate

List of all postprocessors.

Handled as singleton.

Definition at line 286 of file WGEPostprocessor.h.

Referenced by addPostprocessor(), getPostprocessors(), and initPostprocessors().

◆ m_properties

WPropGroup WGEPostprocessor::m_properties
protected

◆ m_resultTextures

std::vector< osg::ref_ptr< osg::Texture2D > > WGEPostprocessor::m_resultTextures
protected

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