OpenWalnut  1.2.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | Private Attributes
WGEOffscreenRenderNode Class Reference

This type of node basically is a convenience class for managing and creating offscreen renderings. More...

#include <WGEOffscreenRenderNode.h>

+ Inheritance diagram for WGEOffscreenRenderNode:

List of all members.

Public Types

typedef osg::ref_ptr
< WGEOffscreenRenderNode
RefPtr
 Convenience typedef for an osg::ref_ptr.
typedef osg::ref_ptr< const
WGEOffscreenRenderNode
ConstRefPtr
 Convenience typedef for an osg::ref_ptr; const.
- Public Types inherited from WGEGroupNode
typedef
WPredicateHelper::ArbitraryPredicateBase
< osg::ref_ptr< osg::Node >
const > 
NodePredicate
 The base type of predicate.

Public Member Functions

 WGEOffscreenRenderNode (osg::ref_ptr< osg::Camera > reference, size_t width=2048, size_t height=2048, bool noHud=false)
 Create a new managing instance.
virtual ~WGEOffscreenRenderNode ()
 Destructor.
osg::ref_ptr< WGETextureHudgetTextureHUD () const
 Returns the instance of the texture HUD.
virtual osg::ref_ptr
< WGEOffscreenRenderPass
addGeometryRenderPass (osg::ref_ptr< osg::Node > node, std::string name="Unnamed")
 Creates a new offscreen-render-pass coupled with the reference camera which renders a specified OSG graph to a texture.
virtual osg::ref_ptr
< WGEOffscreenRenderPass
addGeometryRenderPass (osg::ref_ptr< osg::Node > node, osg::ref_ptr< WGEShader > shader, std::string name="Unnamed")
 Creates a new offscreen-render-pass coupled with the reference camera which renders a specified OSG graph to a texture.
virtual osg::ref_ptr
< WGEOffscreenTexturePass
addTextureProcessingPass (std::string name="Unnamed")
 Creates a new offscreen-render-pass coupled with the reference camera which simply processes textures.
virtual osg::ref_ptr
< WGEOffscreenTexturePass
addTextureProcessingPass (osg::ref_ptr< WGEShader > shader, std::string name="Unnamed")
 Creates a new offscreen-render-pass coupled with the reference camera which simply processes textures.
virtual osg::ref_ptr
< WGEOffscreenFinalPass
addFinalOnScreenPass (std::string name="Unnamed")
 Creates a new render pass which can be seen as put-textures-back-on-screen-pass.
virtual osg::ref_ptr
< WGEOffscreenFinalPass
addFinalOnScreenPass (osg::ref_ptr< WGEShader > shader, std::string name="Unnamed")
 Creates a new render pass which can be seen as put-textures-back-on-screen-pass.
template<typename T >
osg::ref_ptr< T > addRenderPass (std::string name="Unnamed")
 Creates a new offscreen-render-pass coupled with the reference camera.
- Public Member Functions inherited from WGEGroupNode
 WGEGroupNode ()
 Default constructor.
void insert (osg::ref_ptr< osg::Node > node)
 Adds the specified node to the child list of this node in a safe manner.
void remove (osg::ref_ptr< osg::Node > node)
 Removes the specified node from this group in a thread safe manner.
void remove_if (boost::shared_ptr< WGEGroupNode::NodePredicate > predicate)
 Removes a node if the specified predicate evaluates to true.
void clear ()
 Removes all children from this node.

Private Attributes

osg::ref_ptr< osg::Camera > m_referenceCamera
 The camera to which is used for setting this camera up.
osg::ref_ptr< WGETextureHudm_hud
 The pointer to the hud used to render all used texture buffers.
size_t m_textureWidth
 The width of each texture in this offscreen rendering.
size_t m_textureHeight
 The height of each texture in this offscreen rendering.
size_t m_nextPassNum
 The number of the next pass getting added.

Additional Inherited Members

- Protected Types inherited from WGEGroupNode
enum  ChildOperationType { INSERT = 0, REMOVE, REMOVE_IF, CLEAR }
 The type of operation to perform. More...
- Protected Member Functions inherited from WGEGroupNode
virtual ~WGEGroupNode ()
 Destructor.
- Protected Attributes inherited from WGEGroupNode
osg::ref_ptr< SafeUpdaterCallbackm_nodeUpdater
 Node callback used to update this root node.
std::queue< boost::shared_ptr
< ChildOperation > > 
m_childOperationQueue
 Queue of childs that need to be added/removed during the next update cycle.
boost::shared_mutex m_childOperationQueueLock
 Lock used for inserting and removing childs into the child insertion/removal queue.
bool m_childOperationQueueDirty
 Flag denoting whether the m_childOperationQueue should be considered during the next update of the node.
bool m_removeAll
 True whenever all child nodes should be removed.

Detailed Description

This type of node basically is a convenience class for managing and creating offscreen renderings.

The children of this node should be of type WGEOffscreenRenderPass. This class provides factories to create offscreen-render-pass instances with proper sizes with a coupling to a reference camera. This is useful to provide automatic viewport scaling etc. to each render-pass. You do not explicitly need this class to create offscreen-renderings at all. You can manually manage multiple WGEOffscreenRenderPass instances.

It is important to understand, that the graph (your scene) must not be a children of this node. This node can be placed somewhere in your scene. The OSG collects all the cameras (and offscreen-cameras) and render then independently from their position in the graph (except for transformations inherited from others).

Notes:
Please not that you should not modify the whole wiring and offscreen configuration if the this node has been added as it is not thread-safe.

Definition at line 54 of file WGEOffscreenRenderNode.h.


Member Typedef Documentation

Convenience typedef for an osg::ref_ptr; const.

Definition at line 65 of file WGEOffscreenRenderNode.h.

Convenience typedef for an osg::ref_ptr.

Definition at line 60 of file WGEOffscreenRenderNode.h.


Constructor & Destructor Documentation

WGEOffscreenRenderNode::WGEOffscreenRenderNode ( osg::ref_ptr< osg::Camera >  reference,
size_t  width = 2048,
size_t  height = 2048,
bool  noHud = false 
)

Create a new managing instance.

It uses the specified camera as reference to all created offscreen-render-pass instances. Especially viewport, clear-mask and clear-color get used. The default texture resolution is 2048x2048 which is more than full-HD resolution. So it should be enough.

Parameters:
referencecamera used as reference
widththe width of the textures used in this rendering. The real used space is determined by the reference camera.
heightthe height of the textures used in this rendering. The real used space is determined by the reference camera.
noHudIf true, no hud gets displayed showing the created and used textures.

Definition at line 31 of file WGEOffscreenRenderNode.cpp.

References WGEGroupNode::insert(), m_hud, and m_referenceCamera.

WGEOffscreenRenderNode::~WGEOffscreenRenderNode ( )
virtual

Destructor.

Definition at line 49 of file WGEOffscreenRenderNode.cpp.


Member Function Documentation

osg::ref_ptr< WGEOffscreenFinalPass > WGEOffscreenRenderNode::addFinalOnScreenPass ( std::string  name = "Unnamed")
virtual

Creates a new render pass which can be seen as put-textures-back-on-screen-pass.

It renders a full-screen quad to the on-screen frame-buffer. An optional shader can be used for final processing (most commonly clipping, blending, color-mapping and so on).

Parameters:
namethe name of the render pass. You should specify it to enable the nice debugging feature of WGETextureHud.
Returns:
the on-screen render pass which draws processed textures back on screen.

Definition at line 86 of file WGEOffscreenRenderNode.cpp.

osg::ref_ptr< WGEOffscreenFinalPass > WGEOffscreenRenderNode::addFinalOnScreenPass ( osg::ref_ptr< WGEShader shader,
std::string  name = "Unnamed" 
)
virtual

Creates a new render pass which can be seen as put-textures-back-on-screen-pass.

It renders a full-screen quad to the on-screen frame-buffer. An optional shader can be used for final processing (most commonly clipping, blending, color-mapping and so on).

Parameters:
shaderthe shader to add
namethe name of the render pass. You should specify it to enable the nice debugging feature of WGETextureHud.
Returns:
the on-screen render pass which draws processed textures back on screen.

Definition at line 92 of file WGEOffscreenRenderNode.cpp.

osg::ref_ptr< WGEOffscreenRenderPass > WGEOffscreenRenderNode::addGeometryRenderPass ( osg::ref_ptr< osg::Node >  node,
std::string  name = "Unnamed" 
)
virtual

Creates a new offscreen-render-pass coupled with the reference camera which renders a specified OSG graph to a texture.

Parameters:
nodethe node which represents the subgraph.
namethe name of the render pass. You should specify it to enable the nice debugging feature of WGETextureHud.
Notes:
never forget to remove the returned node if not used anymore or use WGEGroup::clean.
Returns:
the geometry render pass.

Definition at line 54 of file WGEOffscreenRenderNode.cpp.

osg::ref_ptr< WGEOffscreenRenderPass > WGEOffscreenRenderNode::addGeometryRenderPass ( osg::ref_ptr< osg::Node >  node,
osg::ref_ptr< WGEShader shader,
std::string  name = "Unnamed" 
)
virtual

Creates a new offscreen-render-pass coupled with the reference camera which renders a specified OSG graph to a texture.

Parameters:
nodethe node which represents the subgraph.
namethe name of the render pass. You should specify it to enable the nice debugging feature of WGETextureHud.
shaderthe shader to add.
Notes:
never forget to remove the returned node if not used anymore or use WGEGroup::clean.
Returns:
the geometry render pass.

Definition at line 62 of file WGEOffscreenRenderNode.cpp.

template<typename T >
osg::ref_ptr< T > WGEOffscreenRenderNode::addRenderPass ( std::string  name = "Unnamed")

Creates a new offscreen-render-pass coupled with the reference camera.

This pass actually does nothing. The method is useful for custom variants of WGEOffscreenRenderPass.

Parameters:
namethe name of the render pass. You should specify it to enable the nice debugging feature of WGETextureHud.
Returns:
new instance of a plain render pass
Template Parameters:
Tthe type of pass to create.

Definition at line 208 of file WGEOffscreenRenderNode.h.

References WGEGroupNode::insert(), m_hud, m_nextPassNum, m_referenceCamera, m_textureHeight, and m_textureWidth.

osg::ref_ptr< WGEOffscreenTexturePass > WGEOffscreenRenderNode::addTextureProcessingPass ( std::string  name = "Unnamed")
virtual

Creates a new offscreen-render-pass coupled with the reference camera which simply processes textures.

All the in- and output textures have to be specified manually.

Notes:
never forget to remove the returned node if not used anymore or use WGEGroup::clean.
Parameters:
namethe name of the render pass. You should specify it to enable the nice debugging feature of WGETextureHud.
Returns:
the texture processing pass created.

Definition at line 73 of file WGEOffscreenRenderNode.cpp.

osg::ref_ptr< WGEOffscreenTexturePass > WGEOffscreenRenderNode::addTextureProcessingPass ( osg::ref_ptr< WGEShader shader,
std::string  name = "Unnamed" 
)
virtual

Creates a new offscreen-render-pass coupled with the reference camera which simply processes textures.

All the in- and output textures have to be specified manually.

Notes:
never forget to remove the returned node if not used anymore or use WGEGroup::clean.
Parameters:
namethe name of the render pass. You should specify it to enable the nice debugging feature of WGETextureHud.
shaderthe shader to add.
Returns:
the texture processing pass created.

Definition at line 79 of file WGEOffscreenRenderNode.cpp.

osg::ref_ptr< WGETextureHud > WGEOffscreenRenderNode::getTextureHUD ( ) const

Returns the instance of the texture HUD.

Returns:
the HUD

Definition at line 99 of file WGEOffscreenRenderNode.cpp.

References m_hud.


Member Data Documentation

osg::ref_ptr< WGETextureHud > WGEOffscreenRenderNode::m_hud
private

The pointer to the hud used to render all used texture buffers.

This can be NULL. It gets distributed to all created render-pass instances.

Definition at line 189 of file WGEOffscreenRenderNode.h.

Referenced by addRenderPass(), getTextureHUD(), and WGEOffscreenRenderNode().

size_t WGEOffscreenRenderNode::m_nextPassNum
private

The number of the next pass getting added.

Definition at line 204 of file WGEOffscreenRenderNode.h.

Referenced by addRenderPass().

osg::ref_ptr< osg::Camera > WGEOffscreenRenderNode::m_referenceCamera
private

The camera to which is used for setting this camera up.

Definition at line 183 of file WGEOffscreenRenderNode.h.

Referenced by addRenderPass(), and WGEOffscreenRenderNode().

size_t WGEOffscreenRenderNode::m_textureHeight
private

The height of each texture in this offscreen rendering.

Definition at line 199 of file WGEOffscreenRenderNode.h.

Referenced by addRenderPass().

size_t WGEOffscreenRenderNode::m_textureWidth
private

The width of each texture in this offscreen rendering.

Definition at line 194 of file WGEOffscreenRenderNode.h.

Referenced by addRenderPass().


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