MeVisLabToolboxReference
MeVisLab/Standard/Sources/Inventor/SoShader/Inventor/nodes/SoFramebufferSampler.h
Go to the documentation of this file.
00001 // **InsertLicense** code
00002 
00006 
00007 
00008 #ifndef  _SO_FRAMEBUFFER_SAMPLER_
00009 #define  _SO_FRAMEBUFFER_SAMPLER_
00010 
00011 #include "SoShaderSystem.h"
00012 #include "Inventor/nodes/SoSampler.h"
00013 #include <Inventor/fields/SoSFNode.h>
00014 #include <Inventor/fields/SoSFColor.h>
00015 #include <Inventor/fields/SoSFFloat.h>
00016 #include <Inventor/fields/SoSFEnum.h>
00017 #include <Inventor/fields/SoSFBool.h>
00018 #include <Inventor/fields/SoSFTrigger.h>
00019 
00020 class SoGLFramebufferObject;
00021 class SoGLTexture;
00022 class SoGLRenderbuffer;
00023 class SoFieldSensor;
00024 class SoSensor;
00025 
00027 SoEXTENDER class INVENTOR_SHADER_API SoFramebufferSampler : public SoSampler
00028 {
00029    typedef SoSampler inherited;
00030 
00031    SO_NODE_ABSTRACT_HEADER(SoFramebufferSampler);
00032 
00033    public:
00034 
00036       enum ColorBufferFormat {
00037         RGB     = GL_RGB,
00038         RGB8    = GL_RGB8,
00039         RGB16   = GL_RGB16,
00040         RGB16F  = GL_RGB16F_ARB,
00041         RGB32F  = GL_RGB32F_ARB,
00042         RGBA    = GL_RGBA,
00043         RGBA8   = GL_RGBA8,
00044         RGBA16  = GL_RGBA16,
00045         RGBA16F = GL_RGBA16F_ARB,
00046         RGBA32F = GL_RGBA32F_ARB
00047       };
00048 
00050       enum DepthBufferTarget {
00051         NONE         = 0,
00052         RENDERBUFFER = 1,
00053         TEXTURE      = 2
00054       };
00055 
00057       SoSFEnum  colorBufferFormat;
00058 
00060       SoSFEnum  depthBufferTarget;
00061 
00063       SoSFBool  stencilBuffer;
00064 
00066       SoSFColor clearColor;
00067 
00069       SoSFFloat clearAlpha;
00070 
00072       SoSFEnum  wrapT;
00073 
00075       SoSFBool  useSizeStateHints;
00076 
00078       SoSFBool  useFormatStateHints;
00079 
00081       SoSFTrigger takeSnapshot;
00082 
00084       SoFramebufferSampler();
00085 
00086    protected:
00087 
00088       SbBool            _fldValUseSizeHints;
00089       SbBool            _fldValUseFormatHints;
00090       ColorBufferFormat _fldValColorBufferFormat;
00091       DepthBufferTarget _fldValDepthBufferTarget;
00092       SbBool            _fldValStencilBuffer;
00093 
00094       SbBool            _rebuild;
00095       SbBool            _takeSnapshot;
00096       int32_t           _dataFormat;
00097 
00099       SbString          _depthTextureName;
00100 
00101       SoGLFramebufferObject       *_framebufferObject;
00102       SoGLTexture                 *_colorBuffer;
00103       SoGLRenderbuffer            *_depthBufferRBU;
00104       SoGLTexture                 *_depthBufferTEX;
00105       SoGLRenderbuffer            *_stencilBuffer;
00106 
00108       ~SoFramebufferSampler();
00109 
00111       virtual void   applyRenderAction(SoState *);
00112 
00114       virtual void   nameChanged(SoSensor *sensor);
00115 
00116    SoEXTENDER public:
00117 
00119       virtual void   GLRender(SoGLRenderAction *action);
00120 
00122       virtual void   getBoundingBox(SoGetBoundingBoxAction *action);
00123 
00124    SoINTERNAL public:
00125 
00127       static void    initClass();
00128 
00129    private:
00130 
00131       SoFieldSensor *_snapshotSensor;
00132       static void snapshotChangedCB(void *data, SoSensor *sensor);
00133 };
00134 
00135 #endif  // _SO_FRAMEBUFFER_SAMPLER_