29 #include "WGEPostprocessor.h"
30 #include "WGEPostprocessorCelShading.h"
31 #include "WGEPostprocessorEdgeEnhance.h"
32 #include "WGEPostprocessorGauss.h"
33 #include "WGEPostprocessorHalftone.h"
34 #include "WGEPostprocessorLineAO.h"
35 #include "WGEPostprocessorSSAO.h"
43 m_properties( std::shared_ptr<
WProperties >( new
WProperties(
"Settings for " + name,
"Post-processing properties" ) ) ),
45 m_description( description )
48 m_effectOnly =
m_properties->addProperty(
"Effect Only",
"If active, the plain effect will be shown instead a combination of effect "
49 "and color. This settings does not affect all postprocessors.",
false );
50 m_effectScale =
m_properties->addProperty(
"Effect Scaling",
"Use this to overemphasize an effect or to weaken it. Technically spoken, this "
51 "factor determines the pre-multiplication done prior to blending with the input color.", 1.0,
58 "WGE_POSTPROCESSOR_OUTPUT_COMBINE",
"WGE_POSTPROCESSOR_OUTPUT_EFFECT_ONLY" ) );
95 m_colorTexture = from[0];
99 m_normalTexture = from[1];
101 if( from.size() > 2 )
103 m_parameterTexture = from[2];
105 if( from.size() > 3 )
107 m_tangentTexture = from[3];
109 if( from.size() > 4 )
116 osg::ref_ptr< osg::Texture2D > normal,
117 osg::ref_ptr< osg::Texture2D > parameter,
118 osg::ref_ptr< osg::Texture2D > tangent,
119 osg::ref_ptr< osg::Texture2D > depth ):
120 m_colorTexture( color ),
121 m_normalTexture( normal ),
122 m_parameterTexture( parameter ),
123 m_tangentTexture( tangent ),
132 buf.
m_normalTexture = from->attach( WGECamera::COLOR_BUFFER1, GL_RGB );
142 to->bind( m_colorTexture, 0 );
143 to->bind( m_normalTexture, 1 );
144 to->bind( m_parameterTexture, 2 );
146 to->bind( m_tangentTexture, 4 );
Cel shading effect postprocessor.
Edge enhancing postprocessor.
Gauss filtering of the input.
This class encapsulates a G-Buffer.
osg::ref_ptr< osg::Texture2D > m_parameterTexture
Some not yet defined parameter texture, LUMINANCE only.
osg::ref_ptr< osg::Texture2D > m_normalTexture
Normal in RGB.
PostprocessorInput()
Constructor creates empty GBuffer.
osg::ref_ptr< osg::Texture2D > m_colorTexture
Color in RGBA.
static PostprocessorInput attach(osg::ref_ptr< WGEOffscreenRenderPass > from)
Attaches the needed textures to the specified render pass and returns the G-Buffer.
osg::ref_ptr< osg::Texture2D > m_tangentTexture
Tangent in RGB.
osg::ref_ptr< osg::Texture2D > m_depthTexture
Depth.
size_t bind(osg::ref_ptr< WGEOffscreenRenderPass > to) const
Attaches these textures to the specified renderpass.
static ProcessorList m_postProcessors
List of all postprocessors.
std::string m_name
Name string.
virtual const std::string getDescription() const
Gets the description for this postprocessor.
WGEShaderPreprocessor::SPtr m_effectOnlyPreprocessor
For convenience, this is a shader preprocessor controlled by m_effectOnly property.
virtual osg::ref_ptr< osg::Texture2D > getOutput(size_t idx=0) const
Returns the result texture.
WPropGroup m_properties
All the properties of the post-processor.
static void initPostprocessors()
Needs to be called prior to any "getPostprocessors" call.
const std::vector< osg::ref_ptr< osg::Texture2D > > & getOutputList() const
This processor can produce multiple outputs.
virtual ~WGEPostprocessor()
Destructor.
WPropDouble m_effectScale
Scale the effect prior to blending it.
WPropBool m_effectOnly
A flag denoting whether the effect should be combined with color or not.
static size_t addPostprocessor(SPtr processor)
Allows adding a postprocessor.
virtual WPropGroup getProperties() const
Returns the set of properties controlling the post-processing node.
static ProcessorList getPostprocessors()
Returns a list of all known postprocessor prototypes.
std::string m_description
Description string.
std::shared_ptr< WGEPostprocessor > SPtr
Convenience typedef for an osg::ref_ptr< WGEPostprocessor >.
std::vector< osg::ref_ptr< osg::Texture2D > > m_resultTextures
The textures contain the result.
virtual osg::ref_ptr< osg::Texture2D > getDepth() const
Returns the new depth texture.
virtual bool getFixedViewportSize() const
When this returns true, the viewport size is fixed to the size of the target texture.
WGEPostprocessor(std::string name, std::string description)
Create named prototype.
osg::ref_ptr< osg::Texture2D > m_depthTexture
The texture contains the new depth.
virtual const std::string getName() const
Gets the name of this postprocessor.
std::vector< WGEPostprocessor::SPtr > ProcessorList
Type used for returning lists of postprocessor prototypes.
std::shared_ptr< WGEShaderPreprocessor > SPtr
Shared pointer for this class.
This is a WGEShaderDefineOptions class which additionally uses a property to automatically control th...
Class to manage properties of an object and to provide convenience methods for easy access and manipu...
Interface class for the concept "Prototype".