25 #ifndef WGEOFFSCREENRENDERNODE_H
26 #define WGEOFFSCREENRENDERNODE_H
32 #include "core/common/WLogger.h"
34 #include "../WGEGroupNode.h"
35 #include "WGEOffscreenRenderPass.h"
36 #include "WGEOffscreenTexturePass.h"
37 #include "WGEOffscreenFinalPass.h"
38 #include "../WGETextureHud.h"
39 #include "../shaders/WGEShader.h"
40 #include "../callbacks/WGEViewportCallback.h"
61 typedef osg::ref_ptr< WGEOffscreenRenderNode >
RefPtr;
66 typedef osg::ref_ptr< const WGEOffscreenRenderNode >
ConstRefPtr;
82 WGEOffscreenRenderNode( osg::ref_ptr< WGECamera > reference,
size_t width = 2048,
size_t height = 2048,
bool noHud =
false );
106 virtual osg::ref_ptr< WGEOffscreenRenderPass >
addGeometryRenderPass( osg::ref_ptr< osg::Node > node, std::string name =
"Unnamed" );
119 virtual osg::ref_ptr< WGEOffscreenRenderPass >
addGeometryRenderPass( osg::ref_ptr< osg::Node > node, osg::ref_ptr< WGEShader > shader,
120 std::string name =
"Unnamed" );
145 virtual osg::ref_ptr< WGEOffscreenTexturePass >
addTextureProcessingPass( osg::ref_ptr< WGEShader > shader, std::string name =
"Unnamed" );
155 virtual osg::ref_ptr< WGEOffscreenFinalPass >
addFinalOnScreenPass( std::string name =
"Unnamed" );
166 virtual osg::ref_ptr< WGEOffscreenFinalPass >
addFinalOnScreenPass( osg::ref_ptr< WGEShader > shader, std::string name =
"Unnamed" );
178 template <
typename T >
179 osg::ref_ptr< T >
addRenderPass( std::string name =
"Unnamed" );
222 osg::ref_ptr< WGETextureHud >
m_hud;
245 template <
typename T >
270 pass->setComputeNearFarMode( osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR );
271 pass->setNearFarRatio( 0.000001 );
272 pass->setCullingMode( osg::CullSettings::NO_CULLING );
Class to wrap around the osg Group node and providing a thread safe add/removal mechanism.
void insert(osg::ref_ptr< osg::Node > node)
Adds the specified node to the child list of this node in a safe manner.
This type of node basically is a convenience class for managing and creating offscreen renderings.
osg::ref_ptr< WGETextureHud > getTextureHUD() const
Returns the instance of the texture HUD.
size_t getTextureWidth() const
Get FBO texture width.
virtual ~WGEOffscreenRenderNode()
Destructor.
size_t m_textureHeight
The height of each texture in this offscreen rendering.
void setLinkViewportToTextureSize(bool vp=true)
If true, the viewport has the size of the resulting texture.
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.
osg::ref_ptr< T > addRenderPass(std::string name="Unnamed")
Creates a new offscreen-render-pass coupled with the reference camera.
WGEOffscreenRenderNode(osg::ref_ptr< WGECamera > reference, size_t width=2048, size_t height=2048, bool noHud=false)
Create a new managing instance.
osg::ref_ptr< WGECamera > m_referenceCamera
The camera to which is used for setting this camera up.
size_t m_textureWidth
The width of each texture in this offscreen rendering.
osg::ref_ptr< WGETextureHud > m_hud
The pointer to the hud used to render all used texture buffers.
osg::ref_ptr< WGEOffscreenRenderNode > RefPtr
Convenience typedef for an osg::ref_ptr.
osg::ref_ptr< const WGEOffscreenRenderNode > ConstRefPtr
Convenience typedef for an osg::ref_ptr; const.
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.
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 g...
bool getLinkViewportToTextureSize() const
The flag denotes whether the viewport is linked to the texture size or the reference camera.
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...
size_t getTextureHeight() const
Get FBO texture height.
This callback is useful to update viewport information on several nodes supporting it.