OpenWalnut  1.4.0
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
WGEOffscreenTexturePass Class Reference

This class encapsulates an OSG Camera and a corresponding framebuffer object. More...

#include <WGEOffscreenTexturePass.h>

+ Inheritance diagram for WGEOffscreenTexturePass:

Classes

class  TextureMatrixUpdateCallback
 Callback which aligns and renders the textures. More...
 

Public Member Functions

 WGEOffscreenTexturePass (size_t textureWidth, size_t textureHeight, int num=0)
 Creates a new offscreen rendering instance. More...
 
 WGEOffscreenTexturePass (size_t textureWidth, size_t textureHeight, osg::ref_ptr< WGETextureHud > hud, std::string name, int num=0)
 Creates a new offscreen rendering instance. More...
 
virtual ~WGEOffscreenTexturePass ()
 Destructor. More...
 
- Public Member Functions inherited from WGEOffscreenRenderPass
 WGEOffscreenRenderPass (size_t textureWidth, size_t textureHeight, int num=0)
 Creates a new offscreen rendering instance. More...
 
 WGEOffscreenRenderPass (size_t textureWidth, size_t textureHeight, osg::ref_ptr< WGETextureHud > hud, std::string name, int num=0)
 Creates a new offscreen rendering instance. More...
 
virtual ~WGEOffscreenRenderPass ()
 Destructor. More...
 
void attach (BufferComponent buffer, osg::ref_ptr< osg::Texture2D > texture)
 Attach a given texture to a buffer. More...
 
void attach (BufferComponent buffer, osg::ref_ptr< osg::Image > image)
 Attach a given image to a buffer. More...
 
osg::ref_ptr< osg::Texture2D > attach (BufferComponent buffer, GLint internalFormat=GL_RGBA)
 This method attaches a texture to the given buffer. More...
 
void detach (BufferComponent buffer)
 Detaches the texture currently bound to the specified buffer. More...
 
template<typename T >
void bind (osg::ref_ptr< T > texture, size_t unit=0)
 This is a shortcut for wge::bindTexture. More...
 
osg::ref_ptr< osg::Texture2D > createTexture (GLint internalFormat=GL_RGBA)
 Creates a new texture suitable for this offscreen rendering instance. More...
 
std::string getName () const
 Returns the name of this render pass. More...
 
size_t getTextureWidth () const
 Get the size of the underlying texture. More...
 
size_t getTextureHeight () const
 Get the size of the underlying texture. More...
 
virtual void addUniform (osg::ref_ptr< osg::Uniform > uniform)
 The uniform to add. More...
 
- Public Member Functions inherited from WGECamera
 WGECamera (int width, int height, ProjectionMode projectionMode)
 Constructor which sets defaults. More...
 
 WGECamera ()
 Constructor which sets defaults. More...
 
void setDefaultProjectionMode (ProjectionMode mode)
 Sets the default projection mode used for cameras getting reset. More...
 
ProjectionMode getDefaultProjectionMode ()
 Returns the current default projection mode. More...
 
void reset ()
 Resets the camera and activates the prior set defaults. More...
 
void resize ()
 Change camera parameters which should be changed on a resize. More...
 

Private Member Functions

void setup ()
 Sets the whole node up. More...
 

Private Attributes

osg::ref_ptr< osg::TexMat > m_texMat
 The texture matrix for this pass. More...
 

Additional Inherited Members

- Public Types inherited from WGEOffscreenRenderPass
typedef osg::ref_ptr
< WGEOffscreenRenderPass
RefPtr
 Convenience typedef for an osg::ref_ptr. More...
 
typedef osg::ref_ptr< const
WGEOffscreenRenderPass
ConstRefPtr
 Convenience typedef for an osg::ref_ptr; const. More...
 
- Static Public Member Functions inherited from WGEOffscreenRenderPass
static std::string getBufferName (BufferComponent buffer)
 Returns the buffer name. More...
 
- Protected Member Functions inherited from WGECamera
virtual ~WGECamera ()
 Destructor. More...
 
- Protected Attributes inherited from WGEOffscreenRenderPass
size_t m_width
 The width of the textures used for this pass. More...
 
size_t m_height
 The height of the textures used for this pass. More...
 
osg::ref_ptr
< osg::FrameBufferObject > 
m_fbo
 The framebuffer object to use for this camera. More...
 
osg::ref_ptr< WGETextureHudm_hud
 Gets notified about any added and removed attachment. More...
 
std::string m_name
 The name if the rendering pass. More...
 

Detailed Description

This class encapsulates an OSG Camera and a corresponding framebuffer object.

It is a specialized variant of WGEOffscreenRenderPass, optimized for processing textures. Therefore, it creates an correctly sized quad and can process each pixel in the fragment shader.

Definition at line 41 of file WGEOffscreenTexturePass.h.

Constructor & Destructor Documentation

WGEOffscreenTexturePass::WGEOffscreenTexturePass ( size_t  textureWidth,
size_t  textureHeight,
int  num = 0 
)

Creates a new offscreen rendering instance.

Parameters
textureWidththe width of all the textures created and used by this render pass. This should be large enough for every reasonable viewport size.
textureHeightthe height of all the textures created and used by this render pass. This should be large enough for every reasonable viewport size.*
numthe order number. This camera gets rendered at the num'th place in the pre render queue of the subgraph it is attached to.

Definition at line 32 of file WGEOffscreenTexturePass.cpp.

References setup().

WGEOffscreenTexturePass::WGEOffscreenTexturePass ( size_t  textureWidth,
size_t  textureHeight,
osg::ref_ptr< WGETextureHud hud,
std::string  name,
int  num = 0 
)

Creates a new offscreen rendering instance.

Parameters
textureWidththe width of all the textures created and used by this render pass. This should be large enough for every reasonable viewport size.
textureHeightthe height of all the textures created and used by this render pass. This should be large enough for every reasonable viewport size.*
numthe order number. This camera gets rendered at the num'th place in the pre render queue of the subgraph it is attached to.
hudthe hud that gets notified about attached and detached textures. Useful for debugging.
namethe name of this render pass. This is a nice debugging feature in conjunction with WGETextureHud as it gets displayed there.

Definition at line 39 of file WGEOffscreenTexturePass.cpp.

References setup().

WGEOffscreenTexturePass::~WGEOffscreenTexturePass ( )
virtual

Destructor.

Definition at line 47 of file WGEOffscreenTexturePass.cpp.

Member Function Documentation

void WGEOffscreenTexturePass::setup ( )
private

Sets the whole node up.

Used to get some code duplication out of the constructors.

Definition at line 52 of file WGEOffscreenTexturePass.cpp.

References wge::genFinitePlane(), and m_texMat.

Referenced by WGEOffscreenTexturePass().

Member Data Documentation

osg::ref_ptr< osg::TexMat > WGEOffscreenTexturePass::m_texMat
private

The texture matrix for this pass.

Used to scale the texture coordinates according to viewport/texture size relation.

Definition at line 83 of file WGEOffscreenTexturePass.h.

Referenced by WGEOffscreenTexturePass::TextureMatrixUpdateCallback::operator()(), and setup().


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