VTK
dox/Rendering/Volume/vtkVolumeTextureMapper.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkVolumeTextureMapper.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 =========================================================================*/
00026 #ifndef __vtkVolumeTextureMapper_h
00027 #define __vtkVolumeTextureMapper_h
00028 
00029 #include "vtkRenderingVolumeModule.h" // For export macro
00030 #include "vtkVolumeMapper.h"
00031 
00032 class vtkEncodedGradientEstimator;
00033 class vtkEncodedGradientShader;
00034 class vtkRenderWindow;
00035 class vtkRenderer;
00036 class vtkVolume;
00037 
00038 class VTKRENDERINGVOLUME_EXPORT vtkVolumeTextureMapper : public vtkVolumeMapper
00039 {
00040 public:
00041   vtkTypeMacro(vtkVolumeTextureMapper,vtkVolumeMapper);
00042   void PrintSelf( ostream& os, vtkIndent indent );
00043 
00045 
00046   virtual void Update();
00047   virtual void Update(int port);
00049 
00051 
00052   virtual void SetGradientEstimator( vtkEncodedGradientEstimator *gradest );
00053   vtkGetObjectMacro( GradientEstimator, vtkEncodedGradientEstimator );
00055 
00057 
00058   vtkGetObjectMacro( GradientShader, vtkEncodedGradientShader );
00060 
00061 //BTX
00063 
00065   float *GetGradientOpacityArray(){return this->GradientOpacityArray;};
00066   unsigned char *GetRGBAArray(){return this->RGBAArray;};
00067   float *GetRedDiffuseShadingTable(){return this->RedDiffuseShadingTable;};
00068   float *GetGreenDiffuseShadingTable(){return this->GreenDiffuseShadingTable;};
00069   float *GetBlueDiffuseShadingTable(){return this->BlueDiffuseShadingTable;};
00070   float *GetRedSpecularShadingTable(){return this->RedSpecularShadingTable;};
00071   float *GetGreenSpecularShadingTable(){return this->GreenSpecularShadingTable;};
00072   float *GetBlueSpecularShadingTable(){return this->BlueSpecularShadingTable;};
00073   unsigned short *GetEncodedNormals(){return this->EncodedNormals;};
00074   unsigned char *GetGradientMagnitudes(){return this->GradientMagnitudes;};
00075   vtkGetMacro( Shade, int );
00076   vtkGetObjectMacro( RenderWindow, vtkRenderWindow );
00077   vtkGetVectorMacro( DataOrigin, double, 3 );
00078   vtkGetVectorMacro( DataSpacing, double, 3 );
00080 
00083   virtual void Render(vtkRenderer *ren, vtkVolume *vol)=0;
00084 
00086 
00088   virtual float GetGradientMagnitudeScale();
00089   virtual float GetGradientMagnitudeBias();
00090   virtual float GetGradientMagnitudeScale(int)
00091     { return this->GetGradientMagnitudeScale(); };
00092   virtual float GetGradientMagnitudeBias(int)
00093     { return this->GetGradientMagnitudeBias(); };
00095 
00096 //ETX
00097 
00098 
00099 
00100 protected:
00101   vtkVolumeTextureMapper();
00102   ~vtkVolumeTextureMapper();
00103 
00104   void InitializeRender( vtkRenderer *ren, vtkVolume *vol );
00105 
00106   virtual void ReportReferences(vtkGarbageCollector*);
00107 
00108   // Objects / variables  needed for shading / gradient magnitude opacity
00109   vtkEncodedGradientEstimator  *GradientEstimator;
00110   vtkEncodedGradientShader     *GradientShader;
00111   int                           Shade;
00112 
00113   float          *GradientOpacityArray;
00114   unsigned char  *RGBAArray;
00115   int             ArraySize;
00116   int             NumberOfComponents;
00117 
00118   float          *RedDiffuseShadingTable;
00119   float          *GreenDiffuseShadingTable;
00120   float          *BlueDiffuseShadingTable;
00121   float          *RedSpecularShadingTable;
00122   float          *GreenSpecularShadingTable;
00123   float          *BlueSpecularShadingTable;
00124 
00125   double          DataOrigin[3];
00126   double          DataSpacing[3];
00127 
00128   unsigned short *EncodedNormals;
00129   unsigned char  *GradientMagnitudes;
00130 
00131   float           SampleDistance;
00132 
00133   vtkRenderWindow *RenderWindow;
00134 private:
00135   vtkVolumeTextureMapper(const vtkVolumeTextureMapper&);  // Not implemented.
00136   void operator=(const vtkVolumeTextureMapper&);  // Not implemented.
00137 };
00138 
00139 
00140 #endif
00141 
00142