00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00078 #ifndef __vtkVolumeTextureMapper3D_h
00079 #define __vtkVolumeTextureMapper3D_h
00080
00081 #include "vtkVolumeMapper.h"
00082
00083 class vtkImageData;
00084 class vtkColorTransferFunction;
00085 class vtkPiecewiseFunction;
00086 class vtkVolumeProperty;
00087
00088 class VTK_VOLUMERENDERING_EXPORT vtkVolumeTextureMapper3D : public vtkVolumeMapper
00089 {
00090 public:
00091 vtkTypeRevisionMacro(vtkVolumeTextureMapper3D,vtkVolumeMapper);
00092 void PrintSelf(ostream& os, vtkIndent indent);
00093
00094 static vtkVolumeTextureMapper3D *New();
00095
00097
00100 vtkSetMacro( SampleDistance, float );
00101 vtkGetMacro( SampleDistance, float );
00103
00105
00106 vtkGetVectorMacro( VolumeDimensions, int, 3 );
00108
00110
00111 vtkGetVectorMacro( VolumeSpacing, float, 3 );
00113
00118 virtual int IsRenderSupported( vtkVolumeProperty * ) {return 0;};
00119
00121
00122 vtkGetMacro( NumberOfPolygons, int );
00124
00126
00127 vtkGetMacro( ActualSampleDistance, float );
00129
00130
00131
00134 virtual void Render(vtkRenderer *, vtkVolume *) {};
00135
00137
00138 enum
00139 {
00140 FRAGMENT_PROGRAM_METHOD=0,
00141 NVIDIA_METHOD=1,
00142 ATI_METHOD=2,
00143 NO_METHOD=3
00144 };
00146
00147
00149
00151 vtkSetClampMacro( PreferredRenderMethod, int,
00152 vtkVolumeTextureMapper3D::FRAGMENT_PROGRAM_METHOD,
00153 vtkVolumeTextureMapper3D::NVIDIA_METHOD );
00154 void SetPreferredMethodToFragmentProgram()
00155 { this->SetPreferredRenderMethod( vtkVolumeTextureMapper3D::FRAGMENT_PROGRAM_METHOD ); }
00156 void SetPreferredMethodToNVidia()
00157 { this->SetPreferredRenderMethod( vtkVolumeTextureMapper3D::NVIDIA_METHOD ); }
00158 vtkGetMacro(PreferredRenderMethod, int);
00160
00161
00163
00168 vtkSetMacro(UseCompressedTexture,bool);
00169 vtkGetMacro(UseCompressedTexture,bool);
00171
00172 protected:
00173 vtkVolumeTextureMapper3D();
00174 ~vtkVolumeTextureMapper3D();
00175
00176 float *PolygonBuffer;
00177 float *IntersectionBuffer;
00178 int NumberOfPolygons;
00179 int BufferSize;
00180
00181 unsigned char *Volume1;
00182 unsigned char *Volume2;
00183 unsigned char *Volume3;
00184 int VolumeSize;
00185 int VolumeComponents;
00186 int VolumeDimensions[3];
00187 float VolumeSpacing[3];
00188
00189 float SampleDistance;
00190 float ActualSampleDistance;
00191
00192 vtkImageData *SavedTextureInput;
00193 vtkImageData *SavedParametersInput;
00194
00195 vtkColorTransferFunction *SavedRGBFunction;
00196 vtkPiecewiseFunction *SavedGrayFunction;
00197 vtkPiecewiseFunction *SavedScalarOpacityFunction;
00198 vtkPiecewiseFunction *SavedGradientOpacityFunction;
00199 int SavedColorChannels;
00200 float SavedSampleDistance;
00201 float SavedScalarOpacityDistance;
00202
00203 unsigned char ColorLookup[65536*4];
00204 unsigned char AlphaLookup[65536];
00205 float TempArray1[3*4096];
00206 float TempArray2[4096];
00207 int ColorTableSize;
00208 float ColorTableScale;
00209 float ColorTableOffset;
00210
00211 unsigned char DiffuseLookup[65536*4];
00212 unsigned char SpecularLookup[65536*4];
00213
00214 vtkTimeStamp SavedTextureMTime;
00215 vtkTimeStamp SavedParametersMTime;
00216
00217 int RenderMethod;
00218 int PreferredRenderMethod;
00219 bool UseCompressedTexture;
00220
00221 bool SupportsNonPowerOfTwoTextures;
00222
00224 void ComputePolygons( vtkRenderer *ren, vtkVolume *vol, double bounds[6] );
00225
00227
00229 int UpdateVolumes( vtkVolume * );
00230 int UpdateColorLookup( vtkVolume * );
00232
00234
00235 virtual int IsTextureSizeSupported(int vtkNotUsed(size)[3],
00236 int vtkNotUsed(components))
00237 {
00238 return 0;
00239 }
00240
00242
00243 private:
00244 vtkVolumeTextureMapper3D(const vtkVolumeTextureMapper3D&);
00245 void operator=(const vtkVolumeTextureMapper3D&);
00246 };
00247
00248
00249 #endif
00250
00251
00252
00253
00254
00255