VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkVolumeTextureMapper3D.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00081 #ifndef __vtkVolumeTextureMapper3D_h 00082 #define __vtkVolumeTextureMapper3D_h 00083 00084 #include "vtkVolumeMapper.h" 00085 00086 class vtkImageData; 00087 class vtkColorTransferFunction; 00088 class vtkPiecewiseFunction; 00089 class vtkVolumeProperty; 00090 00091 class VTK_VOLUMERENDERING_EXPORT vtkVolumeTextureMapper3D : public vtkVolumeMapper 00092 { 00093 public: 00094 vtkTypeMacro(vtkVolumeTextureMapper3D,vtkVolumeMapper); 00095 void PrintSelf(ostream& os, vtkIndent indent); 00096 00097 static vtkVolumeTextureMapper3D *New(); 00098 00100 00103 vtkSetMacro( SampleDistance, float ); 00104 vtkGetMacro( SampleDistance, float ); 00106 00108 00109 vtkGetVectorMacro( VolumeDimensions, int, 3 ); 00111 00113 00114 vtkGetVectorMacro( VolumeSpacing, float, 3 ); 00116 00118 00122 virtual int IsRenderSupported( vtkVolumeProperty *, 00123 vtkRenderer *vtkNotUsed(r)) 00124 {return 0;} 00126 00128 00129 vtkGetMacro( NumberOfPolygons, int ); 00131 00133 00134 vtkGetMacro( ActualSampleDistance, float ); 00136 00137 //BTX 00138 00141 virtual void Render(vtkRenderer *, vtkVolume *) {}; 00142 00144 00145 enum 00146 { 00147 FRAGMENT_PROGRAM_METHOD=0, 00148 NVIDIA_METHOD=1, 00149 ATI_METHOD=2, 00150 NO_METHOD=3 00151 }; 00153 00155 00156 int GetNumberOfScalarComponents(vtkImageData *input); 00157 //ETX 00159 00161 00163 vtkSetClampMacro( PreferredRenderMethod, int, 00164 vtkVolumeTextureMapper3D::FRAGMENT_PROGRAM_METHOD, 00165 vtkVolumeTextureMapper3D::NVIDIA_METHOD ); 00166 void SetPreferredMethodToFragmentProgram() 00167 { this->SetPreferredRenderMethod( vtkVolumeTextureMapper3D::FRAGMENT_PROGRAM_METHOD ); } 00168 void SetPreferredMethodToNVidia() 00169 { this->SetPreferredRenderMethod( vtkVolumeTextureMapper3D::NVIDIA_METHOD ); } 00170 vtkGetMacro(PreferredRenderMethod, int); 00172 00173 00175 00180 vtkSetMacro(UseCompressedTexture,bool); 00181 vtkGetMacro(UseCompressedTexture,bool); 00183 00184 protected: 00185 vtkVolumeTextureMapper3D(); 00186 ~vtkVolumeTextureMapper3D(); 00187 00188 float *PolygonBuffer; 00189 float *IntersectionBuffer; 00190 int NumberOfPolygons; 00191 int BufferSize; 00192 00193 unsigned char *Volume1; 00194 unsigned char *Volume2; 00195 unsigned char *Volume3; 00196 int VolumeSize; 00197 int VolumeComponents; 00198 int VolumeDimensions[3]; 00199 float VolumeSpacing[3]; 00200 00201 float SampleDistance; 00202 float ActualSampleDistance; 00203 00204 vtkImageData *SavedTextureInput; 00205 vtkImageData *SavedParametersInput; 00206 00207 vtkColorTransferFunction *SavedRGBFunction; 00208 vtkPiecewiseFunction *SavedGrayFunction; 00209 vtkPiecewiseFunction *SavedScalarOpacityFunction; 00210 vtkPiecewiseFunction *SavedGradientOpacityFunction; 00211 int SavedColorChannels; 00212 float SavedSampleDistance; 00213 float SavedScalarOpacityDistance; 00214 00215 unsigned char ColorLookup[65536*4]; 00216 unsigned char AlphaLookup[65536]; 00217 float TempArray1[3*4096]; 00218 float TempArray2[4096]; 00219 int ColorTableSize; 00220 float ColorTableScale; 00221 float ColorTableOffset; 00222 00223 unsigned char DiffuseLookup[65536*4]; 00224 unsigned char SpecularLookup[65536*4]; 00225 00226 vtkTimeStamp SavedTextureMTime; 00227 vtkTimeStamp SavedParametersMTime; 00228 00229 int RenderMethod; 00230 int PreferredRenderMethod; 00231 bool UseCompressedTexture; 00232 00233 bool SupportsNonPowerOfTwoTextures; 00234 00236 void ComputePolygons( vtkRenderer *ren, vtkVolume *vol, double bounds[6] ); 00237 00239 00241 int UpdateVolumes( vtkVolume * ); 00242 int UpdateColorLookup( vtkVolume * ); 00244 00246 00247 virtual int IsTextureSizeSupported(int vtkNotUsed(size)[3], 00248 int vtkNotUsed(components)) 00249 { 00250 return 0; 00251 } 00252 //ETX 00254 00255 private: 00256 vtkVolumeTextureMapper3D(const vtkVolumeTextureMapper3D&); // Not implemented. 00257 void operator=(const vtkVolumeTextureMapper3D&); // Not implemented. 00258 }; 00259 00260 00261 #endif 00262 00263 00264 00265 00266 00267