MeVisLabToolboxReference
MeVisLab/Standard/Sources/Inventor/SoShader/Inventor/nodes/SoImageSampler.h
Go to the documentation of this file.
00001 // **InsertLicense** code
00002 //----------------------------------------------------------------------------------
00004 
00012 //----------------------------------------------------------------------------------
00013 
00014 
00015 
00016 #ifndef  _SO_IMAGE_SAMPLER_
00017 #define  _SO_IMAGE_SAMPLER_
00018 
00019 #include "SoShaderSystem.h"
00020 #include "Inventor/nodes/SoSampler.h"
00021 #include "Inventor/misc/SoUniformParameterBase.h"
00022 #include <SoSFMLImage.h>
00023 
00024 #ifdef MEVISLAB
00025 #include <mlGLResources.h>
00026 #endif
00027 
00029 SoEXTENDER class INVENTOR_SHADER_API SoImageSampler : public SoSampler
00030 {
00031    typedef SoSampler inherited;
00032 
00033    SO_NODE_ABSTRACT_HEADER(SoImageSampler);
00034 
00035 
00036    SoEXTENDER public:
00037 
00039       virtual void  updateParameter(SoUniformParameterBase *uniformBase, SoState *state);
00040 
00041    SoINTERNAL public:
00042 
00044       static void   initClass();
00045 
00046    protected:
00047      
00048       virtual ~SoImageSampler();
00049       
00051       SoImageSampler();
00052 
00054       virtual void freeResources();
00055 
00057       virtual void clearTexturData();
00058 
00060       virtual void updateTextureHandle();
00061 
00063       virtual void updateTextureFilteringParameters();
00064 
00067       virtual void updateTextureWrappingParameters();
00068      
00070       virtual void uploadTextureData();
00071 
00073       virtual void uploadDummyTextureData(GLenum target);
00074 
00076       virtual void generateMipmap();
00077 
00079       virtual void updateSamplerInfo(SoUniformParameterBase *uniformBase, SoState *state);
00080 
00082       virtual void setGlTexImage(GLenum target, XVImageSize textureSize, GLint internalFormat, GLint format, GLenum textureDataType, const GLvoid* textureData);
00083 
00085       virtual void updateTextureData(bool force = false);
00086 
00088       virtual void imageChanged() = 0;
00089 
00090 #ifdef MEVISLAB
00091       ml::GLTexture  _textureRes;
00092 #define TEXTUREHANDLE (_textureRes.getHandle())
00093 #else
00094       GLuint         _textureId;
00095 #define TEXTUREHANDLE (_textureId)
00096 #endif
00097 
00099       MLuint8       *_textureData;
00100 
00102       SbBool         _isTextureModified;
00103 
00105       SbSamplerInfo::TextureType _internTexFormat;
00106 
00108       XVImageSize    _textureSize;
00109 
00114       GLenum _target;
00115 
00117       SoUniformParameterBase::SamplerType _samplerType;
00118      
00119 };
00120 
00121 #endif  // _SO_IMAGE_SAMPLER_