VTK
dox/Rendering/Volume/vtkEncodedGradientShader.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkEncodedGradientShader.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 =========================================================================*/
00015 
00032 #ifndef __vtkEncodedGradientShader_h
00033 #define __vtkEncodedGradientShader_h
00034 
00035 #include "vtkRenderingVolumeModule.h" // For export macro
00036 #include "vtkObject.h"
00037 
00038 class vtkVolume;
00039 class vtkRenderer;
00040 class vtkEncodedGradientEstimator;
00041 
00042 #define VTK_MAX_SHADING_TABLES   100
00043 
00044 class VTKRENDERINGVOLUME_EXPORT vtkEncodedGradientShader : public vtkObject
00045 {
00046 public:
00047   static vtkEncodedGradientShader *New();
00048   vtkTypeMacro(vtkEncodedGradientShader,vtkObject);
00049 
00051   void PrintSelf( ostream& os, vtkIndent indent );
00052 
00054 
00056   vtkSetClampMacro( ZeroNormalDiffuseIntensity,  float, 0.0f, 1.0f);
00057   vtkGetMacro( ZeroNormalDiffuseIntensity, float );
00058   vtkSetClampMacro( ZeroNormalSpecularIntensity, float, 0.0f, 1.0f);
00059   vtkGetMacro( ZeroNormalSpecularIntensity, float );
00061 
00063 
00064   void UpdateShadingTable( vtkRenderer *ren, vtkVolume *vol,
00065                            vtkEncodedGradientEstimator *gradest);
00067 
00069 
00070   float *GetRedDiffuseShadingTable(    vtkVolume *vol );
00071   float *GetGreenDiffuseShadingTable(  vtkVolume *vol );
00072   float *GetBlueDiffuseShadingTable(   vtkVolume *vol );
00073   float *GetRedSpecularShadingTable(   vtkVolume *vol );
00074   float *GetGreenSpecularShadingTable( vtkVolume *vol );
00075   float *GetBlueSpecularShadingTable(  vtkVolume *vol );
00077 
00079 
00082   vtkSetClampMacro( ActiveComponent, int, 0, 3 );
00083   vtkGetMacro( ActiveComponent, int );
00085 
00086 protected:
00087   vtkEncodedGradientShader();
00088   ~vtkEncodedGradientShader();
00089 
00091 
00103   void  BuildShadingTable( int index,
00104                            double lightDirection[3],
00105                            double lightAmbientColor[3],
00106                            double lightDiffuseColor[3],
00107                            double lightSpecularColor[3],
00108                            double lightIntensity,
00109                            double viewDirection[3],
00110                            double material[4],
00111                            int twoSided,
00112                            vtkEncodedGradientEstimator *gradest,
00113                            int updateFlag );
00115 
00116   // The six shading tables (r diffuse ,g diffuse ,b diffuse,
00117   // r specular, g specular, b specular ) - with an entry for each
00118   // encoded normal plus one entry at the end for the zero normal
00119   // There is one shading table per volume listed in the ShadingTableVolume
00120   // array. A null entry indicates an available slot.
00121   float                        *ShadingTable[VTK_MAX_SHADING_TABLES][6];
00122   vtkVolume                    *ShadingTableVolume[VTK_MAX_SHADING_TABLES];
00123   int                          ShadingTableSize[VTK_MAX_SHADING_TABLES];
00124 
00125   int                          ActiveComponent;
00126 
00127   // The intensity of light used for the zero normals, since it
00128   // can not be computed from the normal angles. Defaults to 0.0.
00129   float    ZeroNormalDiffuseIntensity;
00130   float    ZeroNormalSpecularIntensity;
00131 private:
00132   vtkEncodedGradientShader(const vtkEncodedGradientShader&);  // Not implemented.
00133   void operator=(const vtkEncodedGradientShader&);  // Not implemented.
00134 };
00135 
00136 
00137 #endif