Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

dox/Rendering/vtkEncodedGradientShader.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkEncodedGradientShader.h,v $
00005   Language:  C++
00006 
00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even 
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00013      PURPOSE.  See the above copyright notice for more information.
00014 
00015 =========================================================================*/
00016 
00036 #ifndef __vtkEncodedGradientShader_h
00037 #define __vtkEncodedGradientShader_h
00038 
00039 #include "vtkObject.h"
00040 
00041 class vtkVolume;
00042 class vtkRenderer;
00043 class vtkEncodedGradientEstimator;
00044 
00045 #define VTK_MAX_SHADING_TABLES   100
00046 
00047 class VTK_RENDERING_EXPORT vtkEncodedGradientShader : public vtkObject
00048 {
00049 public:
00050   static vtkEncodedGradientShader *New();
00051   vtkTypeRevisionMacro(vtkEncodedGradientShader,vtkObject);
00052 
00054   void PrintSelf( ostream& os, vtkIndent indent );
00055 
00057 
00059   vtkSetClampMacro( ZeroNormalDiffuseIntensity,  float, 0.0, 1.0);
00060   vtkGetMacro( ZeroNormalDiffuseIntensity, float );
00061   vtkSetClampMacro( ZeroNormalSpecularIntensity, float, 0.0, 1.0);
00062   vtkGetMacro( ZeroNormalSpecularIntensity, float );
00064 
00066 
00067   void UpdateShadingTable( vtkRenderer *ren, vtkVolume *vol,
00068                            vtkEncodedGradientEstimator *gradest);
00070 
00072 
00073   float *GetRedDiffuseShadingTable(    vtkVolume *vol );
00074   float *GetGreenDiffuseShadingTable(  vtkVolume *vol );
00075   float *GetBlueDiffuseShadingTable(   vtkVolume *vol );
00076   float *GetRedSpecularShadingTable(   vtkVolume *vol );
00077   float *GetGreenSpecularShadingTable( vtkVolume *vol );
00078   float *GetBlueSpecularShadingTable(  vtkVolume *vol );
00080 
00081 protected:
00082   vtkEncodedGradientShader();
00083   ~vtkEncodedGradientShader();
00084 
00086 
00098   void  BuildShadingTable( int index,
00099                            float lightDirection[3],
00100                            float lightColor[3],
00101                            float lightIntensity,
00102                            float viewDirection[3],
00103                            float material[4],
00104                            int twoSided,
00105                            vtkEncodedGradientEstimator *gradest,
00106                            int updateFlag );
00108   
00109   // The six shading tables (r diffuse ,g diffuse ,b diffuse, 
00110   // r specular, g specular, b specular ) - with an entry for each
00111   // encoded normal plus one entry at the end for the zero normal
00112   // There is one shading table per volume listed in the ShadingTableVolume
00113   // array. A null entry indicates an available slot.
00114   float                        *ShadingTable[VTK_MAX_SHADING_TABLES][6];
00115   vtkVolume                    *ShadingTableVolume[VTK_MAX_SHADING_TABLES];
00116   int                          ShadingTableSize[VTK_MAX_SHADING_TABLES];
00117 
00118   // The intensity of light used for the zero normals, since it
00119   // can not be computed from the normal angles. Defaults to 0.0.
00120   float    ZeroNormalDiffuseIntensity;
00121   float    ZeroNormalSpecularIntensity;
00122 private:
00123   vtkEncodedGradientShader(const vtkEncodedGradientShader&);  // Not implemented.
00124   void operator=(const vtkEncodedGradientShader&);  // Not implemented.
00125 }; 
00126 
00127 
00128 #endif