00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef _OSGDVRSIMPLELUTSHADER_H_
00040 #define _OSGDVRSIMPLELUTSHADER_H_
00041 #ifdef __sgi
00042 #pragma once
00043 #endif
00044
00045 #include <OSGConfig.h>
00046
00047 #include <OSGDVRSimpleLUTShaderBase.h>
00048
00049 #include <OSGTextureChunk.h>
00050 #include <OSGFragmentProgramChunk.h>
00051
00052 OSG_BEGIN_NAMESPACE
00053
00057 class OSG_SYSTEMLIB_DLLMAPPING DVRSimpleLUTShader :
00058 public DVRSimpleLUTShaderBase
00059 {
00060 private:
00061
00062 typedef DVRSimpleLUTShaderBase Inherited;
00063
00064
00065 public:
00066
00067
00071 virtual void changed(BitVector whichField,
00072 UInt32 from);
00073
00075
00079 virtual void dump( UInt32 uiIndent = 0,
00080 const BitVector bvFlags = 0) const;
00081
00083
00087
00088 virtual bool initialize (DVRVolume *volume,
00089 DrawActionBase *action);
00090
00091
00092 virtual void activate (DVRVolume *volume,
00093 DrawActionBase *action);
00094
00095
00096 virtual void brickActivate(DVRVolume *volume,
00097 DrawActionBase *action,
00098 Brick *brick );
00099
00100
00101 virtual void deactivate (DVRVolume *volume,
00102 DrawActionBase *action);
00103
00104
00105 virtual void cleanup (DVRVolume *volume,
00106 DrawActionBase *action);
00107
00109
00110
00111 protected:
00112
00113
00114
00115 UInt8 m_nTexturePaletteMode;
00116 Int8 m_nTextureMode;
00117 FragmentProgramChunkPtr m_pFragProg;
00118 TextureChunkPtr m_pDepTexture;
00119
00120 enum LutMode
00121 {
00122 LM_AUTO = 0,
00123 LM_TABLE_SGI,
00124 LM_PALETTE_EXT,
00125 LM_DEPENDENT,
00126 LM_FRAGPROG,
00127 LM_RELOAD,
00128 LM_NO
00129 };
00130
00131
00135 DVRSimpleLUTShader(void);
00136 DVRSimpleLUTShader(const DVRSimpleLUTShader &source);
00137
00139
00143 virtual ~DVRSimpleLUTShader(void);
00144
00146
00150
00151
00152 void getPaletteFormat(DrawActionBase *action,
00153 UInt8 lutMode,
00154 GLenum &internalFormat,
00155 GLenum &externalFormat);
00156
00157
00158 bool isModeSupported (DrawActionBase *action,
00159 UInt8 mode,
00160 Int8 textureMode);
00161
00162 UInt8 selectMode (DrawActionBase *action,
00163 Int8 textureMode);
00164
00165
00166 void enablePalette (void);
00167 void disablePalette(void);
00168
00169
00170 void initDependentTexture ( Int32 size);
00171 void updateDependentTexture ( Int32 size,
00172 const UInt8 *data);
00173 void destroyDependentTexture( void );
00174
00175
00176 void setupAlphaCorrectionRegisterCombiners(DrawActionBase *action);
00177
00179
00180
00181 private:
00182
00183
00184 static char _fragProg2D[];
00185 static char _fragProg3D[];
00186 static char _fragProg2DMulti[];
00187
00188
00189 static UInt32 _sgiTexColorTable;
00190 static UInt32 _extPalettedTexture;
00191 static UInt32 _extSharedPalettedTexture;
00192 static UInt32 _arbMultitexture;
00193 static UInt32 _nvTextureShader2;
00194 static UInt32 _arbFragmentProgram;
00195 static UInt32 _nvRegisterCombiners;
00196
00197
00198 static UInt32 _funcColorTableSGI;
00199 static UInt32 _funcColorTableEXT;
00200 static UInt32 _funcActiveTextureARB;
00201 static UInt32 _funcFinalCombinerInputNV;
00202 static UInt32 _funcCombinerInputNV;
00203 static UInt32 _funcCombinerOutputNV;
00204
00205 friend class FieldContainer;
00206 friend class DVRSimpleLUTShaderBase;
00207
00208 static void initMethod(void);
00209
00210
00211 void operator =(const DVRSimpleLUTShader &source);
00212 };
00213
00214 typedef DVRSimpleLUTShader *DVRSimpleLUTShaderP;
00215
00216 OSG_END_NAMESPACE
00217
00218 #include <OSGDVRSimpleLUTShader.inl>
00219 #include <OSGDVRSimpleLUTShaderBase.inl>
00220
00221 #define OSGDVRSIMPLELUTSHADER_HEADER_CVSID "@(#)$Id: $"
00222
00223 #endif