VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/Rendering/Volume/vtkVolumeTextureMapper3D.h
Go to the documentation of this file.
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 "vtkRenderingVolumeModule.h" // For export macro
00085 #include "vtkVolumeMapper.h"
00086 
00087 class vtkImageData;
00088 class vtkColorTransferFunction;
00089 class vtkPiecewiseFunction;
00090 class vtkVolumeProperty;
00091 
00092 class VTKRENDERINGVOLUME_EXPORT vtkVolumeTextureMapper3D : public vtkVolumeMapper
00093 {
00094 public:
00095   vtkTypeMacro(vtkVolumeTextureMapper3D,vtkVolumeMapper);
00096   void PrintSelf(ostream& os, vtkIndent indent);
00097 
00098   static vtkVolumeTextureMapper3D *New();
00099 
00101 
00104   vtkSetMacro( SampleDistance, float );
00105   vtkGetMacro( SampleDistance, float );
00107 
00109 
00110   vtkGetVectorMacro( VolumeDimensions, int,   3 );
00112 
00114 
00115   vtkGetVectorMacro( VolumeSpacing,    float, 3 );
00117 
00119 
00123   virtual int IsRenderSupported( vtkVolumeProperty *,
00124                                  vtkRenderer *vtkNotUsed(r))
00125     {return 0;}
00127 
00129 
00130   vtkGetMacro( NumberOfPolygons, int );
00132 
00134 
00135   vtkGetMacro( ActualSampleDistance, float );
00137 
00138 //BTX
00139 
00142   virtual void Render(vtkRenderer *, vtkVolume *) {}
00143 
00145 
00146   enum
00147   {
00148     FRAGMENT_PROGRAM_METHOD=0,
00149     NVIDIA_METHOD=1,
00150     ATI_METHOD=2,
00151     NO_METHOD=3
00152   };
00154 
00156 
00157   int GetNumberOfScalarComponents(vtkImageData *input);
00158 //ETX
00160 
00162 
00164   vtkSetClampMacro( PreferredRenderMethod, int,
00165                     vtkVolumeTextureMapper3D::FRAGMENT_PROGRAM_METHOD,
00166                     vtkVolumeTextureMapper3D::NVIDIA_METHOD );
00167   void SetPreferredMethodToFragmentProgram()
00168     { this->SetPreferredRenderMethod( vtkVolumeTextureMapper3D::FRAGMENT_PROGRAM_METHOD ); }
00169   void SetPreferredMethodToNVidia()
00170     { this->SetPreferredRenderMethod( vtkVolumeTextureMapper3D::NVIDIA_METHOD ); }
00171   vtkGetMacro(PreferredRenderMethod, int);
00173 
00174 
00176 
00181   vtkSetMacro(UseCompressedTexture,bool);
00182   vtkGetMacro(UseCompressedTexture,bool);
00184 
00185 protected:
00186   vtkVolumeTextureMapper3D();
00187   ~vtkVolumeTextureMapper3D();
00188 
00189   float                    *PolygonBuffer;
00190   float                    *IntersectionBuffer;
00191   int                       NumberOfPolygons;
00192   int                       BufferSize;
00193 
00194   unsigned char            *Volume1;
00195   unsigned char            *Volume2;
00196   unsigned char            *Volume3;
00197   int                       VolumeSize;
00198   int                       VolumeComponents;
00199   int                       VolumeDimensions[3];
00200   float                     VolumeSpacing[3];
00201 
00202   float                     SampleDistance;
00203   float                     ActualSampleDistance;
00204 
00205   vtkImageData             *SavedTextureInput;
00206   vtkImageData             *SavedParametersInput;
00207 
00208   vtkColorTransferFunction *SavedRGBFunction;
00209   vtkPiecewiseFunction     *SavedGrayFunction;
00210   vtkPiecewiseFunction     *SavedScalarOpacityFunction;
00211   vtkPiecewiseFunction     *SavedGradientOpacityFunction;
00212   int                       SavedColorChannels;
00213   float                     SavedSampleDistance;
00214   float                     SavedScalarOpacityDistance;
00215 
00216   unsigned char             ColorLookup[65536*4];
00217   unsigned char             AlphaLookup[65536];
00218   float                     TempArray1[3*4096];
00219   float                     TempArray2[4096];
00220   int                       ColorTableSize;
00221   float                     ColorTableScale;
00222   float                     ColorTableOffset;
00223 
00224   unsigned char             DiffuseLookup[65536*4];
00225   unsigned char             SpecularLookup[65536*4];
00226 
00227   vtkTimeStamp              SavedTextureMTime;
00228   vtkTimeStamp              SavedParametersMTime;
00229 
00230   int                       RenderMethod;
00231   int                       PreferredRenderMethod;
00232   bool                      UseCompressedTexture;
00233 
00234   bool                      SupportsNonPowerOfTwoTextures;
00235 
00237   void   ComputePolygons( vtkRenderer *ren, vtkVolume *vol, double bounds[6] );
00238 
00240 
00242   int    UpdateVolumes( vtkVolume * );
00243   int    UpdateColorLookup( vtkVolume * );
00245 
00247 
00248   virtual int IsTextureSizeSupported(int vtkNotUsed(size)[3],
00249                                      int vtkNotUsed(components))
00250     {
00251       return 0;
00252     }
00253   //ETX
00255 
00256 private:
00257   vtkVolumeTextureMapper3D(const vtkVolumeTextureMapper3D&);  // Not implemented.
00258   void operator=(const vtkVolumeTextureMapper3D&);  // Not implemented.
00259 };
00260 
00261 
00262 #endif
00263 
00264 
00265 
00266 
00267 
00268