27 #include "../WGETextureHud.h"
28 #include "../WGEGeodeUtils.h"
30 #include "WGEOffscreenTexturePass.h"
56 osg::Vec3( 1.0, 0.0, 0.0 ),
57 osg::Vec3( 0.0, 1.0, 0.0 ) );
62 this->addChild( geode );
65 osg::StateSet* state = this->getOrCreateStateSet();
66 state->setMode( GL_DEPTH_TEST, osg::StateAttribute::OFF );
67 state->setMode( GL_LIGHTING, osg::StateAttribute::PROTECTED );
68 state->setMode( GL_LIGHTING, osg::StateAttribute::OFF );
69 state->setMode( GL_BLEND, osg::StateAttribute::PROTECTED );
70 state->setMode( GL_BLEND, osg::StateAttribute::OFF );
73 setCullingActive(
false );
76 this->setReferenceFrame( osg::Transform::ABSOLUTE_RF );
77 this->setProjectionMatrixAsOrtho2D( 0.0, 1.0, 0.0, 1.0 );
78 this->setViewMatrix( osg::Matrixd::identity() );
82 m_texMat->setMatrix( osg::Matrixd::identity() );
83 state->setTextureAttributeAndModes( 0,
m_texMat, osg::StateAttribute::ON );
92 unsigned int screenWidth =
m_pass->getViewport()->width();
93 unsigned int screenHeight =
m_pass->getViewport()->height();
95 texMat->setMatrix( osg::Matrixd::scale( static_cast< float >( screenWidth ) / static_cast< float >(
m_pass->
getTextureWidth() ),
This class encapsulates an OSG Camera and a corresponding framebuffer object.
size_t getTextureHeight() const
Get the size of the underlying texture.
WGEOffscreenTexturePass * m_pass
The pass used in conjunction with this callback.
void setup()
Sets the whole node up.
virtual ~WGEOffscreenTexturePass()
Destructor.
osg::ref_ptr< osg::Geode > genFinitePlane(double xSize, double ySize, const WPlane &p, const WColor &color=WColor(0.0, 0.7, 0.7, 1.0), bool border=false)
Generates a geode out of a Plane with a fixed size in direction of the vectors which span that plane...
size_t getTextureWidth() const
Get the size of the underlying texture.
osg::ref_ptr< osg::TexMat > m_texMat
The texture matrix for this pass.
virtual void operator()(osg::Node *node, osg::NodeVisitor *nv)
operator () - called during the update traversal.
Callback which aligns and renders the textures.
WGEOffscreenTexturePass(size_t textureWidth, size_t textureHeight, int num=0)
Creates a new offscreen rendering instance.