25 #include "../../common/WPropertyHelper.h"
27 #include "../shaders/WGEShaderPropertyDefineOptions.h"
28 #include "../WGEUtils.h"
30 #include "WGEPostprocessingNode.h"
36 m_postProcessShader( new
WGEShader(
"WGEPostprocessor" ) ),
37 m_properties( boost::shared_ptr<
WProperties >( new
WProperties(
"Post-processing",
"Post-processing properties" ) ) )
47 osg::ref_ptr< osg::Texture2D > renderColorTexture =
m_render->attach( osg::Camera::COLOR_BUFFER0 );
48 osg::ref_ptr< osg::Texture2D > renderNormalTexture =
m_render->attach( osg::Camera::COLOR_BUFFER1 );
49 osg::ref_ptr< osg::Texture2D > renderDepthTexture =
m_render->attach( osg::Camera::DEPTH_BUFFER );
60 std::string(
"The post-processing has to be seen as facility to create appealing images. The here offered options are not all "
61 "possibilities. The most powerful effects can be achieved by using custom combinations (using custom GLSL code) of "
62 "post-processors and is recommended for <b>advanced users</b> only." )
64 m_infoText->setPurpose( PV_PURPOSE_INFORMATION );
68 m_showHUD =
m_properties->addProperty(
"Show HUD",
"If set, the intermediate textures are shown.",
false );
73 std::vector< Tuple > namesAndDefs;
74 namesAndDefs.push_back( Tuple(
"Color Only",
"No Post-Processing.",
"WGE_POSTPROCESSOR_COLOR" ) );
75 namesAndDefs.push_back( Tuple(
"Smoothed Color",
"Smoothed Color Image using Gauss Filter.",
"WGE_POSTPROCESSOR_GAUSSEDCOLOR" ) );
76 namesAndDefs.push_back( Tuple(
"PPL - Phong",
"Per-Pixel-Lighting using Phong.",
"WGE_POSTPROCESSOR_PPLPHONG" ) );
77 namesAndDefs.push_back( Tuple(
"Cel-Shading",
"Under-sampling of the color for cartoon-like shading.",
"WGE_POSTPROCESSOR_CELSHADING" ) );
78 namesAndDefs.push_back( Tuple(
"Depth-Cueing",
"Use the Depth to fade out the pixel's brightness.",
"WGE_POSTPROCESSOR_DEPTHFADING" ) );
79 namesAndDefs.push_back( Tuple(
"Edge",
"Edge of Rendered Geometry.",
"WGE_POSTPROCESSOR_EDGE" ) );
80 namesAndDefs.push_back( Tuple(
"Depth",
"Depth Value only.",
"WGE_POSTPROCESSOR_DEPTH" ) );
81 namesAndDefs.push_back( Tuple(
"Smoothed Depth",
"Gauss-Smoothed Depth Value only.",
"WGE_POSTPROCESSOR_GAUSSEDDEPTH" ) );
82 namesAndDefs.push_back( Tuple(
"Normal",
"Geometry Normal.",
"WGE_POSTPROCESSOR_NORMAL" ) );
83 namesAndDefs.push_back( Tuple(
"Custom",
"Provide Your Own Post-processing-Code.",
"WGE_POSTPROCESSOR_CUSTOM" ) );
89 "Select the post-processings you want.",
108 m_render->detach( osg::Camera::COLOR_BUFFER0 );
109 m_render->detach( osg::Camera::COLOR_BUFFER1 );
121 m_active,
"WGE_POSTPROCESSING_DISABLED",
"WGE_POSTPROCESSING_ENABLED" )
125 shader->addPreprocessor( preproc );
130 w->get()[ node ] = std::make_pair( shader, preproc );
144 if( item != w->get().end() )
147 ( *item ).second.first->removePreprocessor( ( *item ).second.second );
148 w->get().erase( item );
163 ( *iter ).second.first->removePreprocessor( ( *iter ).second.second );