MeVisLab Resolution Independence API
Loading...
Searching...
No Matches
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
30{
31 typedef SoUniformShaderParameter inherited;
32
33 SO_NODE_ABSTRACT_HEADER(SoSampler);
34
35public:
38 NORMAL_MAP = GL_NORMAL_MAP_EXT,
39 REFLECTION_MAP = GL_REFLECTION_MAP_EXT
40 };
41
43 enum Wrap {
44 REPEAT = GL_REPEAT, // Not supported by GL_TEXTURE_RECTANGLE_ARB
45 CLAMP = GL_CLAMP,
46 CLAMP_TO_EDGE = GL_CLAMP_TO_EDGE, // OpenGL 1.2
47 CLAMP_TO_BORDER = GL_CLAMP_TO_BORDER, // OpenGL 1.3
48 MIRRORED_REPEAT = GL_MIRRORED_REPEAT // OpenGL 1.4, not supported by GL_TEXTURE_RECTANGLE_ARB
49 };
50
52 enum Filter {
53 NEAREST = GL_NEAREST,
54 LINEAR = GL_LINEAR,
55 NEAREST_MIPMAP_NEAREST = GL_NEAREST_MIPMAP_NEAREST, // GL_TEXTURE_MIN_FILTER only
56 NEAREST_MIPMAP_LINEAR = GL_NEAREST_MIPMAP_LINEAR, // GL_TEXTURE_MIN_FILTER only
57 LINEAR_MIPMAP_NEAREST = GL_LINEAR_MIPMAP_NEAREST, // GL_TEXTURE_MIN_FILTER only
58 LINEAR_MIPMAP_LINEAR = GL_LINEAR_MIPMAP_LINEAR // GL_TEXTURE_MIN_FILTER only
59 };
60
62 SoSFEnum wrapS;
63
65 SoSFBool enableBorder;
66
68 SoSFVec4f borderColor;
69
71 SoSFEnum minFilter;
72
74 SoSFEnum magFilter;
75
77 SoSFBool use16BitFloat;
78
81
82SoEXTENDER public :
83
85 void updateParameter(SoUniformParameterBase* uniformBase, SoState* state) override;
86
87SoINTERNAL public :
88
90 static void initClass();
91
92protected:
93 ~SoSampler() override;
94
97
100
102 unsigned int _textureComponents;
105
108
110 GLint getInternalFormat(GLenum glDataType);
111
113 const char* getTextureFormatName(GLenum internalFormat);
114
116
118 void postTextureFormatInfo(GLenum target, GLint format);
119
121 void postTextureSizeInfo(GLenum target);
122
124 virtual void nameChanged(SoField* field);
125
127 virtual void texConfigChanged(SoField* /*field*/) {};
128};
129
130#endif // _SO_SAMPLER_
#define INVENTOR_SHADER_API
Define class export specifier.
TextureType
Texture type.
SoSFEnum minFilter
Minification filter mode. Default is LINEAR.
Definition SoSampler.h:71
const char * getTextureFormatName(GLenum internalFormat)
Return texture format name.
GLenum _textureDataType
Definition SoSampler.h:104
SoSFBool use16BitFloat
Use 16 Bit floating point for the texture format.
Definition SoSampler.h:77
unsigned int _textureComponents
Definition SoSampler.h:102
SbBool _hasTextureFloat
TRUE if GL_xxx_texture_float extension is present.
Definition SoSampler.h:96
SbString _sizeUniformName
name of the uniform ?_size parameter
Definition SoSampler.h:99
GLint getInternalFormat(GLenum glDataType)
Return specialized texture format for GL data type.
Filter
Filter methods for minification and magnification.
Definition SoSampler.h:52
@ LINEAR_MIPMAP_LINEAR
Definition SoSampler.h:58
@ NEAREST_MIPMAP_NEAREST
Definition SoSampler.h:55
@ LINEAR_MIPMAP_NEAREST
Definition SoSampler.h:57
@ NEAREST_MIPMAP_LINEAR
Definition SoSampler.h:56
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:65
TexGenMode
Texture gen mode.
Definition SoSampler.h:37
@ REFLECTION_MAP
Definition SoSampler.h:39
SoSampler()
Constructor.
void postTextureSizeInfo(GLenum target)
Prints the size of the bound texture.
SoSFEnum wrapS
Wrapping mode. Default is REPEAT.
Definition SoSampler.h:62
virtual void nameChanged(SoField *field)
Called when sampler name has changed.
Wrap
Texture wrap type.
Definition SoSampler.h:43
@ CLAMP_TO_BORDER
Definition SoSampler.h:47
@ MIRRORED_REPEAT
Definition SoSampler.h:48
@ CLAMP_TO_EDGE
Definition SoSampler.h:46
SoSFBool needsTextureCoordinates
Enable this if the sampler needs the standard inventor texture coordinates.
Definition SoSampler.h:80
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:68
SoSFEnum magFilter
Magnification filter mode. Default is LINEAR.
Definition SoSampler.h:74
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:127
Base class for uniform shader parameters.
SoUniformShaderParameter()
Constructor.