MeVisLab Toolbox Reference
SoFramebufferSampler.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2007, MeVis Medical Solutions AG
4 **
5 ** The user may use this file in accordance with the license agreement provided with
6 ** the Software or, alternatively, in accordance with the terms contained in a
7 ** written agreement between the user and MeVis Medical Solutions AG.
8 **
9 ** For further information use the contact form at https://www.mevislab.de/contact
10 **
11 **************************************************************************************/
12 
13 #ifndef SO_FRAMEBUFFER_SAMPLER_H
14 #define SO_FRAMEBUFFER_SAMPLER_H
15 
16 
18 
19 #include "SoShaderSystem.h"
21 #include <Inventor/fields/SoSFNode.h>
22 #include <Inventor/fields/SoSFColor.h>
23 #include <Inventor/fields/SoSFFloat.h>
24 #include <Inventor/fields/SoSFEnum.h>
25 #include <Inventor/fields/SoSFBool.h>
26 #include <Inventor/fields/SoSFTrigger.h>
27 
28 class SoGLFramebufferObject;
29 class SoGLTexture;
30 class SoGLRenderbuffer;
32 class SoFramebufferSamplerOffscreenSceneRenderer;
33 
35 SoEXTENDER class INVENTOR_SHADER_API SoFramebufferSampler : public SoSampler
36 {
37  typedef SoSampler inherited;
38 
39  SO_NODE_HEADER(SoFramebufferSampler);
40 
41  public:
42 
45  RGB = GL_RGB,
46  RGB8 = GL_RGB8,
47  RGB16 = GL_RGB16,
48  RGB16F = GL_RGB16F_ARB,
49  RGB32F = GL_RGB32F_ARB,
50  RGBA = GL_RGBA,
51  RGBA8 = GL_RGBA8,
52  RGBA16 = GL_RGBA16,
53  RGBA16F = GL_RGBA16F_ARB,
54  RGBA32F = GL_RGBA32F_ARB
55  };
56 
59  NONE = 0,
60  RENDERBUFFER = 1,
61  TEXTURE = 2
62  };
63 
66 
69 
71  SoSFBool stencilBuffer;
72 
74  SoSFColor clearColor;
75 
77  SoSFFloat clearAlpha;
78 
80  SoSFEnum wrapT;
81 
84 
87 
89  SoSFFloat sizeMultiplier;
90 
93  SoSFFloat pixelScale;
94 
97 
99  SoSFTrigger takeSnapshot;
100 
104 
107 
108  protected:
109 
115 
116  SbBool _rebuild;
118  int32_t _dataFormat;
119 
122 
123  SoGLFramebufferObject *_framebufferObject;
124  SoGLTexture *_colorBuffer;
125  SoGLRenderbuffer *_depthBufferRBU;
126  SoGLTexture *_depthBufferTEX;
127  SoGLRenderbuffer *_stencilBuffer;
128 
130 
131  SoFramebufferSamplerOffscreenSceneRenderer* _offscreenSceneRenderer;
132 
135 
137  virtual void applyRenderAction(SoState *);
138 
140  void nameChanged(SoField* field) override;
141 
142  SoEXTENDER public:
143 
145  void GLRender(SoGLRenderAction *action) override;
146 
148  void getBoundingBox(SoGetBoundingBoxAction *action) override;
149 
150  void handleEvent(SoHandleEventAction *action) override;
151 
155 
157  void updatePreparationInternal(SoGLRenderAction* action);
158 
161 
162  SoINTERNAL public:
163 
165  static void initClass();
166 
167  private:
168 
169  void snapshotChangedCB(SoField* field);
170 };
171 
172 #endif // _SO_FRAMEBUFFER_SAMPLER_
Abstract Open Inventor base class for sampler nodes based on a framebuffer object.
SoSFEnum colorBufferFormat
Internal format of color buffer. Default is RGBA.
SoGLFramebufferObject * _framebufferObject
void updatePreparationInternal(SoGLRenderAction *action)
Helper method to call updatePreparation.
static void initClass()
Initialize class with runtime type system.
~SoFramebufferSampler() override
Destructor.
SoSFEnum depthBufferTarget
Enable/Disable depth buffer. Default is TRUE.
SoSFEnum wrapT
Wrapping mode.
SoSFTrigger takeSnapshot
Take a snapshot of the scene.
SoSFBool useFormatStateHints
Read state for format hints.
SoSFFloat sizeMultiplier
Size provided by size state hints is multiplied with this value.
virtual void applyRenderAction(SoState *)
Function applies render action to children.
void renderInSeparateRenderAction()
Renders in an extra render action and tries to reset the GL state as far as possible to avoid that th...
SoSFBool stencilBuffer
Enable/Disable stencil buffer. Default is FALSE.
SoGLRenderbuffer * _stencilBuffer
void handleEvent(SoHandleEventAction *action) override
SoSFBool useSizeStateHints
Read state for size hints.
void getBoundingBox(SoGetBoundingBoxAction *action) override
Compute bounding-box of subgraph.
SoResolutionIndependentViewerProxy * _proxy
void GLRender(SoGLRenderAction *action) override
Add node to parameter list element, and call 'updatePreparation'.
SoSFColor clearColor
Color used to clear the color buffer.
static void resetFixedFunctionGLState()
Resets the current GL state as far as possible (but leaves FBO intact, to allow push/pop later)
ColorBufferFormat
Internal texture format for color buffer.
SoGLRenderbuffer * _depthBufferRBU
SoFramebufferSamplerOffscreenSceneRenderer * _offscreenSceneRenderer
SoSFBool useSeparateRenderAction
If enabled, a separate offscreen renderaction is used instead of the render action of the scene above...
SoSFFloat clearAlpha
Alpha value used to clear the color buffer.
ColorBufferFormat _fldValColorBufferFormat
void nameChanged(SoField *field) override
Called when sampler name has changed.
SoSFBool automaticTraversal
Automatically traverse child scene.
DepthBufferTarget
Depth buffer mode.
DepthBufferTarget _fldValDepthBufferTarget
SoFramebufferSampler()
Constructor.
SbString _depthTextureName
name of the uniform ?_depth parameter
Abstract Open Inventor base class for sampler nodes.
Definition: SoSampler.h:30
SoSFFloat pixelScale
Scale factor for pixel size.