25 #ifndef WGEOFFSCREENRENDERPASS_H
26 #define WGEOFFSCREENRENDERPASS_H
31 #include <osg/FrameBufferObject>
33 #include "../WGEUtils.h"
34 #include "../WGETexture.h"
35 #include "../WGECamera.h"
50 typedef osg::ref_ptr< WGEOffscreenRenderPass >
RefPtr;
55 typedef osg::ref_ptr< const WGEOffscreenRenderPass >
ConstRefPtr;
79 WGEOffscreenRenderPass(
size_t textureWidth,
size_t textureHeight, osg::ref_ptr< WGETextureHud > hud, std::string name,
int num = 0 );
94 void attach( BufferComponent buffer, osg::ref_ptr< osg::Texture2D > texture );
105 void attach( BufferComponent buffer, osg::ref_ptr< osg::Image > image );
119 osg::ref_ptr< osg::Texture2D >
attach( BufferComponent buffer, GLint internalFormat = GL_RGBA );
128 void detach( BufferComponent buffer );
137 template <
typename T >
138 void bind( osg::ref_ptr< T > texture,
size_t unit = 0 );
147 osg::ref_ptr< osg::Texture2D >
createTexture( GLint internalFormat = GL_RGBA );
184 virtual void addUniform( osg::ref_ptr< osg::Uniform > uniform );
199 osg::ref_ptr<osg::FrameBufferObject>
m_fbo;
204 osg::ref_ptr< WGETextureHud >
m_hud;
213 template <
typename T >
Class for wrapping around the OSG Camera class.
This class encapsulates an OSG Camera and a corresponding framebuffer object.
std::string m_name
The name if the rendering pass.
osg::ref_ptr< const WGEOffscreenRenderPass > ConstRefPtr
Convenience typedef for an osg::ref_ptr; const.
osg::ref_ptr< WGETextureHud > m_hud
Gets notified about any added and removed attachment.
osg::ref_ptr< osg::Texture2D > createTexture(GLint internalFormat=GL_RGBA)
Creates a new texture suitable for this offscreen rendering instance.
osg::ref_ptr< osg::FrameBufferObject > m_fbo
The framebuffer object to use for this camera.
size_t m_height
The height of the textures used for this pass.
WGEOffscreenRenderPass(size_t textureWidth, size_t textureHeight, int num=0)
Creates a new offscreen rendering instance.
osg::ref_ptr< WGEOffscreenRenderPass > RefPtr
Convenience typedef for an osg::ref_ptr.
void attach(BufferComponent buffer, osg::ref_ptr< osg::Texture2D > texture)
Attach a given texture to a buffer.
void bind(osg::ref_ptr< T > texture, size_t unit=0)
This is a shortcut for wge::bindTexture.
void detach(BufferComponent buffer)
Detaches the texture currently bound to the specified buffer.
size_t m_width
The width of the textures used for this pass.
size_t getTextureWidth() const
Get the size of the underlying texture.
virtual void addUniform(osg::ref_ptr< osg::Uniform > uniform)
The uniform to add.
size_t getTextureHeight() const
Get the size of the underlying texture.
static std::string getBufferName(BufferComponent buffer)
Returns the buffer name.
virtual ~WGEOffscreenRenderPass()
Destructor.
std::string getName() const
Returns the name of this render pass.
This class implements a HUD showing several textures on screen.
void bindTexture(osg::ref_ptr< osg::Node > node, osg::ref_ptr< WDataTexture3D > texture, size_t unit=0, std::string prefix="")
Binds the specified texture to the specified unit.