29 #include "../../common/WAssert.h"
31 #include "WGEOffscreenRenderNode.h"
33 bool isPowerOfTwo(
size_t x )
35 return ( (x != 0 ) && ( (x & ( ~x + 1 ) ) == x ) );
38 bool checkTextureSize(
size_t size )
40 return !( ( size > 4096 ) || ( size < 8 ) || !isPowerOfTwo( size ) );
45 m_referenceCamera( reference ),
47 m_textureWidth( width ),
48 m_textureHeight( height ),
51 WAssert( checkTextureSize( width ) && checkTextureSize( height ),
"Invalid offscreen texture size. Must be power of two and in [8,4096]." );
58 m_hud->coupleViewportWithTextureViewport();
71 osg::ref_ptr< WGEOffscreenRenderPass > pass = addRenderPass< WGEOffscreenRenderPass >( name );
72 pass->addChild( node );
77 osg::ref_ptr< WGEShader > shader,
81 osg::ref_ptr< WGEOffscreenRenderPass > pass = addRenderPass< WGEOffscreenRenderPass >( name );
82 pass->addChild( node );
83 shader->apply( pass );
89 osg::ref_ptr< WGEOffscreenTexturePass > pass = addRenderPass< WGEOffscreenTexturePass >( name );
95 osg::ref_ptr< WGEOffscreenTexturePass > pass = addRenderPass< WGEOffscreenTexturePass >( name );
96 shader->apply( pass );
102 osg::ref_ptr< WGEOffscreenFinalPass > pass = addRenderPass< WGEOffscreenFinalPass >( name );
108 osg::ref_ptr< WGEOffscreenFinalPass > pass = addRenderPass< WGEOffscreenFinalPass >( name );
109 shader->apply( pass );