OpenWalnut
1.4.0
|
The base class for all custom post-processors. More...
#include <WGEPostprocessor.h>
Classes | |
class | PostprocessorInput |
This class encapsulates a G-Buffer. More... | |
Public Types | |
typedef boost::shared_ptr < WGEPostprocessor > | SPtr |
Convenience typedef for an osg::ref_ptr< WGEPostprocessor >. | |
typedef boost::shared_ptr < const WGEPostprocessor > | ConstSPtr |
Convenience typedef for an osg::ref_ptr< const WGEPostprocessor >. | |
typedef std::vector < WGEPostprocessor::SPtr > | ProcessorList |
Type used for returning lists of postprocessor prototypes. | |
Public Member Functions | |
WGEPostprocessor (std::string name, std::string description) | |
Create named prototype. | |
virtual | ~WGEPostprocessor () |
Destructor. | |
virtual SPtr | create (osg::ref_ptr< WGEOffscreenRenderNode > offscreen, const PostprocessorInput &gbuffer) const =0 |
Create instance. | |
virtual WPropGroup | getProperties () const |
Returns the set of properties controlling the post-processing node. | |
virtual osg::ref_ptr < osg::Texture2D > | getOutput (size_t idx=0) const |
Returns the result texture. | |
const std::vector < osg::ref_ptr< osg::Texture2D > > & | getOutputList () const |
This processor can produce multiple outputs. | |
virtual osg::ref_ptr < osg::Texture2D > | getDepth () const |
Returns the new depth texture. | |
virtual const std::string | getName () const |
Gets the name of this postprocessor. | |
virtual const std::string | getDescription () const |
Gets the description for this postprocessor. | |
virtual bool | getFixedViewportSize () const |
When this returns true, the viewport size is fixed to the size of the target texture. | |
Static Public Member Functions | |
static ProcessorList | getPostprocessors () |
Returns a list of all known postprocessor prototypes. | |
static void | initPostprocessors () |
Needs to be called prior to any "getPostprocessors" call. | |
static size_t | addPostprocessor (SPtr processor) |
Allows adding a postprocessor. | |
Protected Attributes | |
std::vector< osg::ref_ptr < osg::Texture2D > > | m_resultTextures |
The textures contain the result. | |
osg::ref_ptr< osg::Texture2D > | m_depthTexture |
The texture contains the new depth. | |
WPropGroup | m_properties |
All the properties of the post-processor. | |
WPropBool | m_effectOnly |
A flag denoting whether the effect should be combined with color or not. | |
WPropDouble | m_effectScale |
Scale the effect prior to blending it. | |
WGEShaderPreprocessor::SPtr | m_effectOnlyPreprocessor |
For convenience, this is a shader preprocessor controlled by m_effectOnly property. | |
Private Attributes | |
std::string | m_name |
Name string. | |
std::string | m_description |
Description string. | |
Static Private Attributes | |
static ProcessorList | m_postProcessors |
List of all postprocessors. |
The base class for all custom post-processors.
It allows building an own texture processing pipeline for special processings.
Definition at line 51 of file WGEPostprocessor.h.
typedef boost::shared_ptr< const WGEPostprocessor > WGEPostprocessor::ConstSPtr |
Convenience typedef for an osg::ref_ptr< const WGEPostprocessor >.
Reimplemented in WGEPostprocessorMergeOp, WGEPostprocessorGauss, WGEPostprocessorCelShading, WGEPostprocessorEdgeEnhance, WGEPostprocessorLineAO, and WGEPostprocessorSSAO.
Definition at line 140 of file WGEPostprocessor.h.
typedef std::vector< WGEPostprocessor::SPtr > WGEPostprocessor::ProcessorList |
Type used for returning lists of postprocessor prototypes.
Definition at line 145 of file WGEPostprocessor.h.
typedef boost::shared_ptr< WGEPostprocessor > WGEPostprocessor::SPtr |
Convenience typedef for an osg::ref_ptr< WGEPostprocessor >.
Reimplemented in WGEPostprocessorMergeOp, WGEPostprocessorGauss, WGEPostprocessorCelShading, WGEPostprocessorEdgeEnhance, WGEPostprocessorLineAO, and WGEPostprocessorSSAO.
Definition at line 135 of file WGEPostprocessor.h.
WGEPostprocessor::WGEPostprocessor | ( | std::string | name, |
std::string | description | ||
) |
Create named prototype.
You should call this in your prototype constructor.
name | name of processor |
description | description. |
Definition at line 38 of file WGEPostprocessor.cpp.
References m_effectOnly, m_effectOnlyPreprocessor, m_effectScale, and m_properties.
WGEPostprocessor::~WGEPostprocessor | ( | ) | [virtual] |
Destructor.
Definition at line 60 of file WGEPostprocessor.cpp.
size_t WGEPostprocessor::addPostprocessor | ( | SPtr | processor | ) | [static] |
Allows adding a postprocessor.
After this call, everyone using the WGEPostprocessor can utilize your addded postproc.
processor | the postprocessor to add |
Definition at line 165 of file WGEPostprocessor.cpp.
References m_postProcessors.
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.
offscreen | use this offscreen node to add your texture pass' |
gbuffer | the input textures you should use |
Implemented in WGEPostprocessorMergeOp, WGEPostprocessorGauss, WGEPostprocessorLineAO, WGEPostprocessorSSAO, WGEPostprocessorCelShading, and WGEPostprocessorEdgeEnhance.
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!
Definition at line 80 of file WGEPostprocessor.cpp.
References m_depthTexture.
const std::string WGEPostprocessor::getDescription | ( | ) | const [virtual] |
Gets the description for this postprocessor.
Implements WPrototyped.
Definition at line 176 of file WGEPostprocessor.cpp.
References m_description.
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.
Definition at line 181 of file WGEPostprocessor.cpp.
const std::string WGEPostprocessor::getName | ( | ) | const [virtual] |
Gets the name of this postprocessor.
Implements WPrototyped.
Definition at line 171 of file WGEPostprocessor.cpp.
References m_name.
osg::ref_ptr< osg::Texture2D > WGEPostprocessor::getOutput | ( | size_t | idx = 0 | ) | const [virtual] |
Returns the result texture.
Use this to continue processing.
idx | which output. Each postprocessor returns at least one texture in index 0, which also is the default value |
Definition at line 70 of file WGEPostprocessor.cpp.
References m_resultTextures.
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.
Definition at line 75 of file WGEPostprocessor.cpp.
References m_resultTextures.
Returns a list of all known postprocessor prototypes.
Definition at line 150 of file WGEPostprocessor.cpp.
References m_postProcessors.
Referenced by WGEPostprocessingNode::WGEPostprocessingNode().
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.
Definition at line 65 of file WGEPostprocessor.cpp.
References m_properties.
void WGEPostprocessor::initPostprocessors | ( | ) | [static] |
Needs to be called prior to any "getPostprocessors" call.
Needed for initialization. This is done by WGraphicsEngine.
Definition at line 155 of file WGEPostprocessor.cpp.
References m_postProcessors.
Referenced by WGraphicsEngine::threadMain().
osg::ref_ptr< osg::Texture2D > WGEPostprocessor::m_depthTexture [protected] |
The texture contains the new depth.
Definition at line 254 of file WGEPostprocessor.h.
Referenced by WGEPostprocessor::PostprocessorInput::bind(), getDepth(), and WGEPostprocessor::PostprocessorInput::PostprocessorInput().
std::string WGEPostprocessor::m_description [private] |
Description string.
Set by the constructor.
Definition at line 284 of file WGEPostprocessor.h.
Referenced by getDescription().
WPropBool WGEPostprocessor::m_effectOnly [protected] |
A flag denoting whether the effect should be combined with color or not.
Definition at line 264 of file WGEPostprocessor.h.
Referenced by WGEPostprocessor(), and WGEPostprocessorCelShading::WGEPostprocessorCelShading().
For convenience, this is a shader preprocessor controlled by m_effectOnly property.
Definition at line 274 of file WGEPostprocessor.h.
Referenced by WGEPostprocessor(), WGEPostprocessorCelShading::WGEPostprocessorCelShading(), WGEPostprocessorEdgeEnhance::WGEPostprocessorEdgeEnhance(), WGEPostprocessorGauss::WGEPostprocessorGauss(), WGEPostprocessorLineAO::WGEPostprocessorLineAO(), WGEPostprocessorMergeOp::WGEPostprocessorMergeOp(), and WGEPostprocessorSSAO::WGEPostprocessorSSAO().
WPropDouble WGEPostprocessor::m_effectScale [protected] |
Scale the effect prior to blending it.
Definition at line 269 of file WGEPostprocessor.h.
Referenced by WGEPostprocessor(), and WGEPostprocessorLineAO::WGEPostprocessorLineAO().
std::string WGEPostprocessor::m_name [private] |
Name string.
Set by the constructor.
Definition at line 279 of file WGEPostprocessor.h.
Referenced by getName().
WGEPostprocessor::ProcessorList WGEPostprocessor::m_postProcessors [static, private] |
List of all postprocessors.
Handled as singleton.
Definition at line 289 of file WGEPostprocessor.h.
Referenced by addPostprocessor(), getPostprocessors(), and initPostprocessors().
WPropGroup WGEPostprocessor::m_properties [protected] |
All the properties of the post-processor.
Definition at line 259 of file WGEPostprocessor.h.
Referenced by getProperties(), WGEPostprocessor(), WGEPostprocessorCelShading::WGEPostprocessorCelShading(), WGEPostprocessorEdgeEnhance::WGEPostprocessorEdgeEnhance(), WGEPostprocessorLineAO::WGEPostprocessorLineAO(), and WGEPostprocessorSSAO::WGEPostprocessorSSAO().
std::vector< osg::ref_ptr< osg::Texture2D > > WGEPostprocessor::m_resultTextures [protected] |
The textures contain the result.
Add at least one result texture
Definition at line 249 of file WGEPostprocessor.h.
Referenced by getOutput(), getOutputList(), WGEPostprocessorCelShading::WGEPostprocessorCelShading(), WGEPostprocessorEdgeEnhance::WGEPostprocessorEdgeEnhance(), WGEPostprocessorGauss::WGEPostprocessorGauss(), WGEPostprocessorLineAO::WGEPostprocessorLineAO(), WGEPostprocessorMergeOp::WGEPostprocessorMergeOp(), and WGEPostprocessorSSAO::WGEPostprocessorSSAO().