29 #include "../../common/WAssert.h"
30 #include "../WGEUtils.h"
32 #include "WGEOffscreenRenderNode.h"
34 bool isPowerOfTwo(
size_t x )
36 return ( (x != 0 ) && ( (x & ( ~x + 1 ) ) == x ) );
39 bool checkTextureSize(
size_t size )
41 return !( ( size > 8192 ) || ( size < 8 ) );
46 m_referenceCamera( reference ),
48 m_textureWidth( width ),
49 m_textureHeight( height ),
51 m_forceViewportTextureSize( false )
53 WAssert( checkTextureSize( width ) && checkTextureSize( height ),
"Invalid offscreen texture size. Must be power of two and in [8,4096]." );
60 m_hud->coupleViewportWithTextureViewport();
73 osg::ref_ptr< WGEOffscreenRenderPass > pass = addRenderPass< WGEOffscreenRenderPass >( name );
74 pass->addChild( node );
88 osg::ref_ptr< WGEShader > shader,
92 osg::ref_ptr< WGEOffscreenRenderPass > pass = addRenderPass< WGEOffscreenRenderPass >( name );
93 pass->addChild( node );
94 shader->apply( pass );
108 osg::ref_ptr< WGEOffscreenTexturePass > pass = addRenderPass< WGEOffscreenTexturePass >( name );
114 osg::ref_ptr< WGEOffscreenTexturePass > pass = addRenderPass< WGEOffscreenTexturePass >( name );
115 shader->apply( pass );
121 osg::ref_ptr< WGEOffscreenFinalPass > pass = addRenderPass< WGEOffscreenFinalPass >( name );
127 osg::ref_ptr< WGEOffscreenFinalPass > pass = addRenderPass< WGEOffscreenFinalPass >( name );
128 shader->apply( pass );