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

vtkEncodedGradientShader.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkEncodedGradientShader.h,v $
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 
00044 #ifndef __vtkEncodedGradientShader_h
00045 #define __vtkEncodedGradientShader_h
00046 
00047 #include "vtkObject.h"
00048 
00049 class vtkVolume;
00050 class vtkRenderer;
00051 class vtkEncodedGradientEstimator;
00052 
00053 #define VTK_MAX_SHADING_TABLES   100
00054 
00055 class VTK_RENDERING_EXPORT vtkEncodedGradientShader : public vtkObject
00056 {
00057 public:
00058   static vtkEncodedGradientShader *New();
00059   vtkTypeRevisionMacro(vtkEncodedGradientShader,vtkObject);
00060 
00062   void PrintSelf( ostream& os, vtkIndent indent );
00063 
00065 
00067   vtkSetClampMacro( ZeroNormalDiffuseIntensity,  float, 0.0, 1.0);
00068   vtkGetMacro( ZeroNormalDiffuseIntensity, float );
00069   vtkSetClampMacro( ZeroNormalSpecularIntensity, float, 0.0, 1.0);
00070   vtkGetMacro( ZeroNormalSpecularIntensity, float );
00072 
00074 
00075   void UpdateShadingTable( vtkRenderer *ren, vtkVolume *vol,
00076                            vtkEncodedGradientEstimator *gradest);
00078 
00080 
00081   float *GetRedDiffuseShadingTable(    vtkVolume *vol );
00082   float *GetGreenDiffuseShadingTable(  vtkVolume *vol );
00083   float *GetBlueDiffuseShadingTable(   vtkVolume *vol );
00084   float *GetRedSpecularShadingTable(   vtkVolume *vol );
00085   float *GetGreenSpecularShadingTable( vtkVolume *vol );
00086   float *GetBlueSpecularShadingTable(  vtkVolume *vol );
00088 
00090 
00093   vtkSetClampMacro( ActiveComponent, int, 0, 3 );
00094   vtkGetMacro( ActiveComponent, int );
00096   
00097 protected:
00098   vtkEncodedGradientShader();
00099   ~vtkEncodedGradientShader();
00100 
00102 
00114   void  BuildShadingTable( int index,
00115                            double lightDirection[3],
00116                            double lightColor[3],
00117                            double lightIntensity,
00118                            double viewDirection[3],
00119                            double material[4],
00120                            int twoSided,
00121                            vtkEncodedGradientEstimator *gradest,
00122                            int updateFlag );
00124   
00125   // The six shading tables (r diffuse ,g diffuse ,b diffuse, 
00126   // r specular, g specular, b specular ) - with an entry for each
00127   // encoded normal plus one entry at the end for the zero normal
00128   // There is one shading table per volume listed in the ShadingTableVolume
00129   // array. A null entry indicates an available slot.
00130   float                        *ShadingTable[VTK_MAX_SHADING_TABLES][6];
00131   vtkVolume                    *ShadingTableVolume[VTK_MAX_SHADING_TABLES];
00132   int                          ShadingTableSize[VTK_MAX_SHADING_TABLES];
00133 
00134   int                          ActiveComponent;
00135   
00136   // The intensity of light used for the zero normals, since it
00137   // can not be computed from the normal angles. Defaults to 0.0.
00138   float    ZeroNormalDiffuseIntensity;
00139   float    ZeroNormalSpecularIntensity;
00140 private:
00141   vtkEncodedGradientShader(const vtkEncodedGradientShader&);  // Not implemented.
00142   void operator=(const vtkEncodedGradientShader&);  // Not implemented.
00143 }; 
00144 
00145 
00146 #endif