This class enables you to add arbitrary nodes that get post-processed in screen space. More...
#include <WGEPostprocessingNode.h>
Public Types | |
typedef osg::ref_ptr < WGEPostprocessingNode > | RefPtr |
Convenience typedef for an osg::ref_ptr. | |
typedef osg::ref_ptr< const WGEPostprocessingNode > | ConstRefPtr |
Convenience typedef for an osg::ref_ptr; const. | |
Public Member Functions | |
WGEPostprocessingNode (osg::ref_ptr< osg::Camera > reference, size_t width=2048, size_t height=2048, bool noHud=false) | |
Create a new post-processing node. | |
virtual | ~WGEPostprocessingNode () |
Destructor. | |
WPropGroup | getProperties () const |
Returns the set of properties controlling the post-processing node. | |
void | insert (osg::ref_ptr< osg::Node > node, WGEShader::RefPtr shader=NULL) |
Inserts a node to the post-processor and injects the needed code to the specified shader. | |
void | remove (osg::ref_ptr< osg::Node > node) |
Removes the node from the post-processing. | |
void | clear () |
Removes all associated nodes. | |
void | setEnabled (bool enable=true) |
Activates/Deactivates the post-processing. | |
Private Types | |
typedef WSharedAssociativeContainer < std::map< osg::ref_ptr < osg::Node >, std::pair < WGEShader::RefPtr, WGEShaderPreprocessor::SPtr > > > | NodeShaderAssociation |
This type is used to actually store the association between a node and its associated shader and custom preprocessor. | |
Private Attributes | |
NodeShaderAssociation | m_nodeShaderAssociation |
List of nodes and their corresponding shader and preprocessor. | |
osg::ref_ptr < WGEOffscreenRenderNode > | m_offscreen |
The actual offscreen render node. | |
osg::ref_ptr< WGEGroupNode > | m_childs |
The group of child nodes to post-process. | |
osg::ref_ptr < WGEOffscreenRenderPass > | m_render |
The first pass, rendering. | |
osg::ref_ptr < WGEOffscreenFinalPass > | m_postprocess |
The actual post-processing. | |
WGEShader::RefPtr | m_postProcessShader |
This shader actually does post-processing in screen space. | |
WPropGroup | m_properties |
All the properties of the post-processor. | |
WPropBool | m_active |
If true, post-processing is enabled. | |
WPropBool | m_showHUD |
If true, a HUD with intermediate textures is shown. | |
WPropSelection | m_activePostprocessors |
The property containing the currently active method or a combination. | |
boost::shared_ptr< WItemSelection > | m_possiblePostprocessors |
Possible post-processors. | |
WPropString | m_infoText |
Some text denoting that this is not yet completely done. |
This class enables you to add arbitrary nodes that get post-processed in screen space.
The only thing you need to take care of is your shader. You need some special parts in it. Please see the all-in-one super-shader-example module WMShaderExample in modules/template.
Definition at line 52 of file WGEPostprocessingNode.h.
typedef osg::ref_ptr< const WGEPostprocessingNode > WGEPostprocessingNode::ConstRefPtr |
Convenience typedef for an osg::ref_ptr; const.
Definition at line 64 of file WGEPostprocessingNode.h.
typedef WSharedAssociativeContainer< std::map< osg::ref_ptr< osg::Node >, std::pair< WGEShader::RefPtr, WGEShaderPreprocessor::SPtr > > > WGEPostprocessingNode::NodeShaderAssociation [private] |
This type is used to actually store the association between a node and its associated shader and custom preprocessor.
Definition at line 140 of file WGEPostprocessingNode.h.
typedef osg::ref_ptr< WGEPostprocessingNode > WGEPostprocessingNode::RefPtr |
Convenience typedef for an osg::ref_ptr.
Definition at line 59 of file WGEPostprocessingNode.h.
WGEPostprocessingNode::WGEPostprocessingNode | ( | osg::ref_ptr< osg::Camera > | reference, | |
size_t | width = 2048 , |
|||
size_t | height = 2048 , |
|||
bool | noHud = false | |||
) |
Create a new post-processing node.
It used the WGEOffscreenRenderNode to setup an offscreen, shader-based post-processing for rendered images. This is not limited to geometry but can also be used for ray-traced images.
reference | camera used as reference | |
width | the width of the textures used in this rendering | |
height | the height of the textures used in this rendering* | |
noHud | If true, no hud gets displayed showing the created and used textures. |
Definition at line 32 of file WGEPostprocessingNode.cpp.
References WPropertyHelper::PC_NOTEMPTY::addTo(), WGEShaderPropertyDefineOptionsTools::createSelection(), WGEShaderPropertyDefineOptions< PropType, PropIndexAdapter >::getProperty(), m_active, m_activePostprocessors, m_childs, m_infoText, m_offscreen, m_postprocess, m_postProcessShader, m_properties, m_render, and m_showHUD.
WGEPostprocessingNode::~WGEPostprocessingNode | ( | ) | [virtual] |
void WGEPostprocessingNode::clear | ( | ) |
Removes all associated nodes.
Definition at line 155 of file WGEPostprocessingNode.cpp.
References WSharedObject< T >::getWriteTicket(), m_childs, and m_nodeShaderAssociation.
WPropGroup WGEPostprocessingNode::getProperties | ( | ) | const |
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 112 of file WGEPostprocessingNode.cpp.
References m_properties.
void WGEPostprocessingNode::insert | ( | osg::ref_ptr< osg::Node > | node, | |
WGEShader::RefPtr | shader = NULL | |||
) |
Inserts a node to the post-processor and injects the needed code to the specified shader.
See class documentation for further details on how the shader gets modified. If you are using an group node, be yourself aware that all nodes in this group need to have the same shader! If not, post-processing will not work properly.
node | the node to post-process | |
shader | the shader used for the node |
Definition at line 117 of file WGEPostprocessingNode.cpp.
References WSharedObject< T >::getWriteTicket(), m_active, m_childs, and m_nodeShaderAssociation.
void WGEPostprocessingNode::remove | ( | osg::ref_ptr< osg::Node > | node | ) |
Removes the node from the post-processing.
If it is not in the post-processing pipeline, nothing happens.
node | the node to remove |
Definition at line 136 of file WGEPostprocessingNode.cpp.
References WSharedObject< T >::getWriteTicket(), m_childs, and m_nodeShaderAssociation.
void WGEPostprocessingNode::setEnabled | ( | bool | enable = true |
) |
Activates/Deactivates the post-processing.
This is a shortcut for getProperties()->getProperty( "Enable" )->toPropBool()->set( enable ).
enable | if true, post-processing is active- |
Definition at line 171 of file WGEPostprocessingNode.cpp.
References m_active.
WPropBool WGEPostprocessingNode::m_active [private] |
If true, post-processing is enabled.
Definition at line 180 of file WGEPostprocessingNode.h.
Referenced by insert(), setEnabled(), and WGEPostprocessingNode().
WPropSelection WGEPostprocessingNode::m_activePostprocessors [private] |
The property containing the currently active method or a combination.
Definition at line 190 of file WGEPostprocessingNode.h.
Referenced by WGEPostprocessingNode().
osg::ref_ptr< WGEGroupNode > WGEPostprocessingNode::m_childs [private] |
The group of child nodes to post-process.
Definition at line 155 of file WGEPostprocessingNode.h.
Referenced by clear(), insert(), remove(), and WGEPostprocessingNode().
WPropString WGEPostprocessingNode::m_infoText [private] |
Some text denoting that this is not yet completely done.
Definition at line 200 of file WGEPostprocessingNode.h.
Referenced by WGEPostprocessingNode().
List of nodes and their corresponding shader and preprocessor.
Definition at line 145 of file WGEPostprocessingNode.h.
osg::ref_ptr< WGEOffscreenRenderNode > WGEPostprocessingNode::m_offscreen [private] |
The actual offscreen render node.
Definition at line 150 of file WGEPostprocessingNode.h.
Referenced by WGEPostprocessingNode().
boost::shared_ptr< WItemSelection > WGEPostprocessingNode::m_possiblePostprocessors [private] |
Possible post-processors.
Definition at line 195 of file WGEPostprocessingNode.h.
osg::ref_ptr< WGEOffscreenFinalPass > WGEPostprocessingNode::m_postprocess [private] |
The actual post-processing.
Definition at line 165 of file WGEPostprocessingNode.h.
Referenced by WGEPostprocessingNode().
This shader actually does post-processing in screen space.
Definition at line 170 of file WGEPostprocessingNode.h.
Referenced by WGEPostprocessingNode().
WPropGroup WGEPostprocessingNode::m_properties [private] |
All the properties of the post-processor.
Definition at line 175 of file WGEPostprocessingNode.h.
Referenced by getProperties(), and WGEPostprocessingNode().
osg::ref_ptr< WGEOffscreenRenderPass > WGEPostprocessingNode::m_render [private] |
The first pass, rendering.
Definition at line 160 of file WGEPostprocessingNode.h.
Referenced by WGEPostprocessingNode(), and ~WGEPostprocessingNode().
WPropBool WGEPostprocessingNode::m_showHUD [private] |
If true, a HUD with intermediate textures is shown.
Definition at line 185 of file WGEPostprocessingNode.h.
Referenced by WGEPostprocessingNode().