OpenWalnut  1.4.0
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 Member Functions

 WGEOffscreenRenderNode (osg::ref_ptr< WGECamera > 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.
size_t getTextureWidth () const
 Get FBO texture width.
size_t getTextureHeight () const
 Get FBO texture height.
void setLinkViewportToTextureSize (bool vp=true)
 If true, the viewport has the size of the resulting texture.
bool getLinkViewportToTextureSize () const
 The flag denotes whether the viewport is linked to the texture size or the reference camera.

Private Attributes

osg::ref_ptr< WGECameram_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.
bool m_forceViewportTextureSize
 Flag denotes whether the viewport is coupled to the reference camera or the texture size.

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 55 of file WGEOffscreenRenderNode.h.


Member Typedef Documentation

Convenience typedef for an osg::ref_ptr; const.

Definition at line 66 of file WGEOffscreenRenderNode.h.

Convenience typedef for an osg::ref_ptr.

Definition at line 61 of file WGEOffscreenRenderNode.h.


Constructor & Destructor Documentation

WGEOffscreenRenderNode::WGEOffscreenRenderNode ( osg::ref_ptr< WGECamera 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.

Notes:
The width and hight define the offscreen texture size. The viewport if each rendering is automatically set to the one of the reference camera. This means, width and height only define the maximal supported resolution without upscaling of your offscreen renderer.
Parameters:
referencecamera used as reference
widththe width of the textures used in this rendering. Must be in [8,4096] and a power of two.
heightthe height of the textures used in this rendering. Must be in [8,4096] and a power of two.
noHudIf true, no hud gets displayed showing the created and used textures.

Definition at line 44 of file WGEOffscreenRenderNode.cpp.

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

Destructor.

Definition at line 65 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 119 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 125 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 70 of file WGEOffscreenRenderNode.cpp.

References wge::generateDynamicCullProxy(), and WGEGroupNode::insert().

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 87 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 246 of file WGEOffscreenRenderNode.h.

References WGEGroupNode::insert(), m_forceViewportTextureSize, 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 106 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 112 of file WGEOffscreenRenderNode.cpp.

The flag denotes whether the viewport is linked to the texture size or the reference camera.

See setLinkViewportToTextureSize for details.

Returns:
the flag.

Definition at line 152 of file WGEOffscreenRenderNode.cpp.

References m_forceViewportTextureSize.

Get FBO texture height.

Returns:
the height

Definition at line 142 of file WGEOffscreenRenderNode.cpp.

References m_textureHeight.

Returns the instance of the texture HUD.

Returns:
the HUD

Definition at line 132 of file WGEOffscreenRenderNode.cpp.

References m_hud.

Get FBO texture width.

Returns:
the width

Definition at line 137 of file WGEOffscreenRenderNode.cpp.

References m_textureWidth.

If true, the viewport has the size of the resulting texture.

This is very interesting if you want to force large scale renderings and want to decouple your offscreen pass from the reference camera viewport.

Parameters:
vpif true, viewport is forced to be the whole texture size

Definition at line 147 of file WGEOffscreenRenderNode.cpp.

References m_forceViewportTextureSize.


Member Data Documentation

Flag denotes whether the viewport is coupled to the reference camera or the texture size.

Definition at line 242 of file WGEOffscreenRenderNode.h.

Referenced by addRenderPass(), getLinkViewportToTextureSize(), and setLinkViewportToTextureSize().

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 222 of file WGEOffscreenRenderNode.h.

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

The number of the next pass getting added.

Definition at line 237 of file WGEOffscreenRenderNode.h.

Referenced by addRenderPass().

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

Definition at line 216 of file WGEOffscreenRenderNode.h.

Referenced by addRenderPass(), and WGEOffscreenRenderNode().

The height of each texture in this offscreen rendering.

Definition at line 232 of file WGEOffscreenRenderNode.h.

Referenced by addRenderPass(), and getTextureHeight().

The width of each texture in this offscreen rendering.

Definition at line 227 of file WGEOffscreenRenderNode.h.

Referenced by addRenderPass(), and getTextureWidth().


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