MeVisLabToolboxReference
|
00001 #ifndef __View2DShader_H 00002 #define __View2DShader_H 00003 //---------------------------------------------------------------------------------- 00004 // **InsertLicense** code 00005 //---------------------------------------------------------------------------------- 00007 00013 //---------------------------------------------------------------------------------- 00014 00015 #ifndef __SoView2DSystem_H 00016 #include "SoView2DSystem.h" 00017 #endif 00018 00019 #ifndef __mlDataTypes_H 00020 #include "mlDataTypes.h" 00021 #endif 00022 00023 #include "View2DTexture.h" 00024 #include "mlGLResourceManager.h" 00025 00026 #define VIEW2D_BICUBIC_FILTER_TEX_SIZE 256 00027 00028 // declare the LUTData 00029 ML_START_NAMESPACE 00030 template <typename T> class LUTData; 00031 ML_END_NAMESPACE 00032 00034 class SOVIEW2D_API View2DShader { 00035 public: 00036 View2DShader(); 00037 virtual ~View2DShader(); 00038 00040 virtual const char* name() = 0; 00041 00043 virtual void bind(View2DTexture* texture, int tw, int th) = 0; 00044 00046 virtual void unbind() = 0; 00047 00049 virtual void getRequiredTextureLayout(View2DTexture *texture, GLuint &format, GLuint &internalFormat, GLuint &transferDataType); 00050 00052 virtual void setLut(ml::LUTData<MLuint8>* newLut) { _lut = newLut; } 00053 00055 ml::LUTData<MLuint8>* getLut() { return _lut; } 00056 00058 void invalidateLut() { _lastLutChangeID = 0; } 00059 00060 protected: 00061 00063 ml::LUTData<MLuint8>* _lut; 00064 00066 MLuint32 _lastLutChangeID; 00067 00069 int _lastLutSize; 00070 00071 }; 00072 00073 //----------------------------------------------------------------------------------------------- 00075 class View2DTextureLUTShader : public View2DShader { 00076 00077 public: 00078 View2DTextureLUTShader(); 00079 virtual ~View2DTextureLUTShader(); 00080 00081 protected: 00083 void createLutTexture(); 00084 00086 void updateLutTexture(); 00087 00089 void destroyLutTexture(); 00090 00092 void createFilterKernelTexture(); 00094 void destroyFilterKernelTexture(); 00095 00097 ml::GLTexture _lutTexture; 00098 ml::GLTexture _kernelTexture; 00099 00101 int _lutTextureWidth; 00103 int _lutTextureHeight; 00105 int _lutHeight; 00106 }; 00107 00108 #endif