00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00072 #ifndef __vtkVolumeTextureMapper3D_h
00073 #define __vtkVolumeTextureMapper3D_h
00074
00075 #include "vtkVolumeMapper.h"
00076
00077 class vtkImageData;
00078 class vtkColorTransferFunction;
00079 class vtkPiecewiseFunction;
00080 class vtkVolumeProperty;
00081
00082 class VTK_VOLUMERENDERING_EXPORT vtkVolumeTextureMapper3D : public vtkVolumeMapper
00083 {
00084 public:
00085 vtkTypeRevisionMacro(vtkVolumeTextureMapper3D,vtkVolumeMapper);
00086 void PrintSelf(ostream& os, vtkIndent indent);
00087
00088 static vtkVolumeTextureMapper3D *New();
00089
00091
00094 vtkSetMacro( SampleDistance, float );
00095 vtkGetMacro( SampleDistance, float );
00097
00099
00100 vtkGetVectorMacro( VolumeDimensions, int, 3 );
00102
00104
00105 vtkGetVectorMacro( VolumeSpacing, float, 3 );
00107
00112 virtual int IsRenderSupported( vtkVolumeProperty * ) {return 0;};
00113
00115
00116 vtkGetMacro( NumberOfPolygons, int );
00118
00120
00121 vtkGetMacro( ActualSampleDistance, float );
00123
00124
00125
00128 virtual void Render(vtkRenderer *, vtkVolume *) {};
00129
00131
00132 enum
00133 {
00134 FRAGMENT_PROGRAM_METHOD=0,
00135 NVIDIA_METHOD=1,
00136 ATI_METHOD=2,
00137 NO_METHOD=3
00138 };
00140
00141
00143
00145 vtkSetClampMacro( PreferredRenderMethod, int,
00146 vtkVolumeTextureMapper3D::FRAGMENT_PROGRAM_METHOD,
00147 vtkVolumeTextureMapper3D::NVIDIA_METHOD );
00148 void SetPreferredMethodToFragmentProgram()
00149 { this->SetPreferredRenderMethod( vtkVolumeTextureMapper3D::FRAGMENT_PROGRAM_METHOD ); }
00150 void SetPreferredMethodToNVidia()
00151 { this->SetPreferredRenderMethod( vtkVolumeTextureMapper3D::NVIDIA_METHOD ); }
00153
00154
00155
00156 protected:
00157 vtkVolumeTextureMapper3D();
00158 ~vtkVolumeTextureMapper3D();
00159
00160 float *PolygonBuffer;
00161 float *IntersectionBuffer;
00162 int NumberOfPolygons;
00163 int BufferSize;
00164
00165 unsigned char *Volume1;
00166 unsigned char *Volume2;
00167 unsigned char *Volume3;
00168 int VolumeSize;
00169 int VolumeComponents;
00170 int VolumeDimensions[3];
00171 float VolumeSpacing[3];
00172
00173 float SampleDistance;
00174 float ActualSampleDistance;
00175
00176 vtkImageData *SavedTextureInput;
00177 vtkImageData *SavedParametersInput;
00178
00179 vtkColorTransferFunction *SavedRGBFunction;
00180 vtkPiecewiseFunction *SavedGrayFunction;
00181 vtkPiecewiseFunction *SavedScalarOpacityFunction;
00182 vtkPiecewiseFunction *SavedGradientOpacityFunction;
00183 int SavedColorChannels;
00184 float SavedSampleDistance;
00185 float SavedScalarOpacityDistance;
00186
00187 unsigned char ColorLookup[65536*4];
00188 unsigned char AlphaLookup[65536];
00189 float TempArray1[3*4096];
00190 float TempArray2[4096];
00191 int ColorTableSize;
00192 float ColorTableScale;
00193 float ColorTableOffset;
00194
00195 unsigned char DiffuseLookup[65536*4];
00196 unsigned char SpecularLookup[65536*4];
00197
00198 vtkTimeStamp SavedTextureMTime;
00199 vtkTimeStamp SavedParametersMTime;
00200
00201 int RenderMethod;
00202 int PreferredRenderMethod;
00203
00205 void ComputePolygons( vtkRenderer *ren, vtkVolume *vol, double bounds[6] );
00206
00208
00210 int UpdateVolumes( vtkVolume * );
00211 int UpdateColorLookup( vtkVolume * );
00213
00215
00216 virtual int IsTextureSizeSupported( int [3] ) {return 0;};
00217
00219
00220 private:
00221 vtkVolumeTextureMapper3D(const vtkVolumeTextureMapper3D&);
00222 void operator=(const vtkVolumeTextureMapper3D&);
00223 };
00224
00225
00226 #endif
00227
00228
00229
00230
00231
00232