MeVisLabToolboxReference
MeVisLab/Standard/Sources/Inventor/SoShader/Inventor/nodes/SoMLSampler.h
Go to the documentation of this file.
00001 // **InsertLicense** code
00002 
00006 
00007 
00008 #ifndef  _SO_ML_SAMPLER_
00009 #define  _SO_ML_SAMPLER_
00010 
00011 #include "SoShaderSystem.h"
00012 #include "Inventor/nodes/SoImageSampler.h"
00013 #include <Inventor/elements/SoMLImageElement.h>
00014 #include <SoSFMLImage.h>
00015 
00016 
00017 class SoSensor;
00018 class SoFieldSensor;
00019 
00021 SoEXTENDER class INVENTOR_SHADER_API SoMLSampler : public SoImageSampler
00022 {
00023    typedef SoImageSampler inherited;
00024 
00025    SO_NODE_ABSTRACT_HEADER(SoMLSampler);
00026 
00027    public:
00028 
00030       SoSFMLImage  image;
00031 
00033       SoSFUInt32   startT;
00034 
00036       SoSFUInt32   startU;
00037 
00038    SoEXTENDER public:
00039 
00041       virtual void   GLRender(SoGLRenderAction *action);
00042  
00044       virtual void   updateParameter(SoUniformParameterBase *uniformBase, SoState *state);
00045 
00046    SoINTERNAL public:
00047 
00049       static  void   initClass();
00050 
00051    protected:
00052 
00054       SbSamplerInfo::TextureType _internTexFormat;
00055       
00056 
00058       SbMLImageProperties  _imgProps;
00059 
00061       SoMLSampler();
00062 
00064       virtual ~SoMLSampler();
00065 
00067       GLenum         MLToGLDataType(const MLDataType &dType);
00068 
00071       MLuint8       *loadAndReformatSubImg(XVImageSize pos, XVImageSize size);
00072       
00074       virtual void   texConfigChanged(SoSensor *sensor);
00075 
00077       virtual void   imageChanged();
00078       static  void   imageChangedCB(void *data, SoSensor *sensor);
00079 
00081       virtual void getSubimageProperties(XVImageSize inputSize, XVImageSize &subimageSize, XVImageSize &subimagePosition) = 0;
00082 
00084       virtual void getTextureDataFromImage(XVImageSize size, XVImageSize pos);
00085 
00087       void clampIntFieldValue(SoSFUInt32 &field, int minValue, int maxValue);
00088 
00089    private:
00090 
00091       SoFieldSensor *_imageSensor;
00092 
00093       SoFieldSensor *_startTSensor;
00094       SoFieldSensor *_startUSensor;
00095 };
00096 
00097 #endif  // _SO_ML_SAMPLER_