MeVisLab Toolbox Reference
SoSampler.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_SAMPLER_H
14 #define SO_SAMPLER_H
15 
16 
18 
19 #include "SoShaderSystem.h"
22 #include <Inventor/fields/SoSFUInt32.h>
23 #include <Inventor/fields/SoSFEnum.h>
24 #include <Inventor/fields/SoSFBool.h>
25 #include <Inventor/fields/SoSFVec4f.h>
26 #include <GL/glew.h>
27 
29 SoEXTENDER class INVENTOR_SHADER_API SoSampler : public SoUniformShaderParameter
30 {
32 
33  SO_NODE_ABSTRACT_HEADER(SoSampler);
34 
35  public:
36 
38  enum TexGenMode {
39  NORMAL_MAP = GL_NORMAL_MAP_EXT,
40  REFLECTION_MAP = GL_REFLECTION_MAP_EXT
41  };
42 
44  enum Wrap {
45  REPEAT = GL_REPEAT, // Not supported by GL_TEXTURE_RECTANGLE_ARB
46  CLAMP = GL_CLAMP,
47  CLAMP_TO_EDGE = GL_CLAMP_TO_EDGE, // OpenGL 1.2
48  CLAMP_TO_BORDER = GL_CLAMP_TO_BORDER, // OpenGL 1.3
49  MIRRORED_REPEAT = GL_MIRRORED_REPEAT // OpenGL 1.4, not supported by GL_TEXTURE_RECTANGLE_ARB
50  };
51 
53  enum Filter {
54  NEAREST = GL_NEAREST,
55  LINEAR = GL_LINEAR,
56  NEAREST_MIPMAP_NEAREST = GL_NEAREST_MIPMAP_NEAREST, // GL_TEXTURE_MIN_FILTER only
57  NEAREST_MIPMAP_LINEAR = GL_NEAREST_MIPMAP_LINEAR, // GL_TEXTURE_MIN_FILTER only
58  LINEAR_MIPMAP_NEAREST = GL_LINEAR_MIPMAP_NEAREST, // GL_TEXTURE_MIN_FILTER only
59  LINEAR_MIPMAP_LINEAR = GL_LINEAR_MIPMAP_LINEAR // GL_TEXTURE_MIN_FILTER only
60  };
61 
63  SoSFEnum wrapS;
64 
66  SoSFBool enableBorder;
67 
69  SoSFVec4f borderColor;
70 
72  SoSFEnum minFilter;
73 
75  SoSFEnum magFilter;
76 
78  SoSFBool use16BitFloat;
79 
82 
83  SoEXTENDER public:
84 
86  void updateParameter(SoUniformParameterBase *uniformBase, SoState *state) override;
87 
88  SoINTERNAL public:
89 
91  static void initClass();
92 
93  protected:
94 
95  ~SoSampler() override;
96 
99 
102 
104  unsigned int _textureComponents;
107 
110 
112  GLint getInternalFormat(GLenum glDataType);
113 
115  const char * getTextureFormatName(GLenum internalFormat);
116 
118 
120  void postTextureFormatInfo(GLenum target, GLint format);
121 
124 
126  virtual void nameChanged(SoField* field);
127 
129  virtual void texConfigChanged(SoField* /*field*/) {};
130 };
131 
132 #endif // _SO_SAMPLER_
TextureType
Texture type.
Abstract Open Inventor base class for sampler nodes.
Definition: SoSampler.h:30
SoSFEnum minFilter
Minification filter mode. Default is LINEAR.
Definition: SoSampler.h:72
GLenum _textureDataType
Definition: SoSampler.h:106
SoSFBool use16BitFloat
Use 16 Bit floating point for the texture format.
Definition: SoSampler.h:78
unsigned int _textureComponents
Definition: SoSampler.h:104
SbBool _hasTextureFloat
TRUE if GL_xxx_texture_float extension is present.
Definition: SoSampler.h:98
SbString _sizeUniformName
name of the uniform ?_size parameter
Definition: SoSampler.h:101
GLint getInternalFormat(GLenum glDataType)
Return specialized texture format for GL data type.
Filter
Filter methods for minification and magnification.
Definition: SoSampler.h:53
void updateParameter(SoUniformParameterBase *uniformBase, SoState *state) override
Assigns or updates the parameter's value.
SoSFBool enableBorder
Enable border to be part of the texture. Default is FALSE.
Definition: SoSampler.h:66
TexGenMode
Texture gen mode.
Definition: SoSampler.h:38
SoSampler()
Constructor.
void postTextureSizeInfo(GLenum target)
Prints the size of the bound texture.
SoSFEnum wrapS
Wrapping mode. Default is REPEAT.
Definition: SoSampler.h:63
virtual void nameChanged(SoField *field)
Called when sampler name has changed.
const char * getTextureFormatName(GLenum internalFormat)
Return texture format name.
Wrap
Texture wrap type.
Definition: SoSampler.h:44
SoSFBool needsTextureCoordinates
Enable this if the sampler needs the standard inventor texture coordinates.
Definition: SoSampler.h:81
void postTextureFormatInfo(GLenum target, GLint format)
Prints channel depths for given target and format.
SbSamplerInfo::TextureType getTextureTypeFromGLFormat(GLenum internalFormat)
SoSFVec4f borderColor
Border color used to for border texture filtering. Only used if 'enableBorder' is FALSE....
Definition: SoSampler.h:69
SoSFEnum magFilter
Magnification filter mode. Default is LINEAR.
Definition: SoSampler.h:75
static void initClass()
Initialize class with runtime type system.
~SoSampler() override
virtual void texConfigChanged(SoField *)
Called when texture configuration (e.g. filter mode) has changed.
Definition: SoSampler.h:129
Base class for uniform shader parameters.
Abstract Open Inventor base class for uniform shader parameter nodes.
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.