MeVisLab Toolbox Reference
SoImageSampler.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2012, 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_IMAGE_SAMPLER_H
14 #define SO_IMAGE_SAMPLER_H
15 
16 
18 
21 
22 #include "SoShaderSystem.h"
25 #include <SoSFMLImage.h>
26 #include <mlGLResources.h>
27 
29 SoEXTENDER class INVENTOR_SHADER_API SoImageSampler : public SoSampler
30 {
31  typedef SoSampler inherited;
32 
33  SO_NODE_ABSTRACT_HEADER(SoImageSampler);
34 
35  SoEXTENDER public:
36 
38  void updateParameter(SoUniformParameterBase *uniformBase, SoState *state) override;
39 
40  SoINTERNAL public:
41 
43  static void initClass();
44 
45  protected:
46 
49 
51  ~SoImageSampler() override;
52 
54  virtual void freeTextureBuffer();
55 
57  virtual void updateTextureHandle();
58 
61 
65 
67  virtual void uploadTextureBuffer();
68 
70  virtual void uploadDummyTexture(GLenum target);
71 
73  virtual void generateMipmap();
74 
76  virtual void setGLTexImage(GLenum target, const XVImageSize &textureSize, GLint internalFormat, GLint format, GLenum textureDataType, const GLvoid *textureData) = 0;
77 
79  virtual void updateTextureBuffer();
80 
82  virtual void updateSamplerInfo(SoUniformParameterBase *uniformBase, SoState *state);
83 
85  virtual void imageChanged() = 0;
86 
87  ml::GLTexture _textureRes;
88 
91 
94 
97 
100 
105  GLenum _target;
106 
109 
110 };
111 
112 #endif // _SO_IMAGE_SAMPLER_
TextureType
Texture type.
The abstract Inventor class SoImageSampler.
virtual void freeTextureBuffer()
Delete the texture buffer(s).
virtual void setGLTexImage(GLenum target, const XVImageSize &textureSize, GLint internalFormat, GLint format, GLenum textureDataType, const GLvoid *textureData)=0
Set the OpenGL texture.
virtual void generateMipmap()
Generates mipmap.
virtual void imageChanged()=0
Called when the image has changed and is valid.
SbSamplerInfo::TextureType _internTexFormat
Value points to internal texture format.
SbBool _isTextureModified
Indicates changes in the internal texture.
virtual void updateSamplerInfo(SoUniformParameterBase *uniformBase, SoState *state)
Set info about the purpose of the uniform parameter and add info about sampler to state.
XVImageSize _textureSize
size of the internal texture
virtual void updateTextureHandle()
Creates texture handle and binds it.
MLuint8 * _textureBuffer
Buffered texture that is uploaded.
virtual void updateTextureFilteringParameters()
Sets parameters for texture filtering.
ml::GLTexture _textureRes
virtual void updateTextureWrappingParameters()
Sets parameters for texture wrapping in OpenGL.
virtual void uploadDummyTexture(GLenum target)
Upload a dummy texture consisting of one black voxel using setGLTexImage.
GLenum _target
Specifies the target to which the texture is bound.
static void initClass()
Initialize class with runtime type system.
SoImageSampler()
Constructor.
virtual void updateTextureBuffer()
Calls imageChanged() if _textureBuffer is empty.
~SoImageSampler() override
Destructor.
virtual void uploadTextureBuffer()
Uploads data stored in _textureBuffer using setGLTexImage.
void updateParameter(SoUniformParameterBase *uniformBase, SoState *state) override
Assigns or updates the parameter's value.
SoUniformParameterBase::SamplerType _samplerType
Specifies the sampler type. Must be either SAMPLER_1D, SAMPLER_2D, SAMPLER_3D or SAMPLER_CUBEMAP.
Abstract Open Inventor base class for sampler nodes.
Definition: SoSampler.h:30
Base class for uniform shader parameters.
SoSFMLImage - field interface to ML images and related classes.
Definition: SoSFMLImage.h:32
unsigned char MLuint8
Definition: mlTypeDefs.h:115
boost::graph_traits< ml_graph_ptr >::vertex_descriptor target(graph_traits< ml_graph_ptr >::edge_descriptor e, const ml_graph_ptr)
Returns the vertex descriptor for v of the edge (u,v) represented by e.