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

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 
00047 #ifndef __vtkEncodedGradientShader_h
00048 #define __vtkEncodedGradientShader_h
00049 
00050 #include "vtkObject.h"
00051 
00052 class vtkVolume;
00053 class vtkRenderer;
00054 class vtkEncodedGradientEstimator;
00055 
00056 #define VTK_MAX_SHADING_TABLES   100
00057 
00058 class VTK_RENDERING_EXPORT vtkEncodedGradientShader : public vtkObject
00059 {
00060 public:
00061   static vtkEncodedGradientShader *New();
00062   vtkTypeRevisionMacro(vtkEncodedGradientShader,vtkObject);
00063 
00065   void PrintSelf( ostream& os, vtkIndent indent );
00066 
00068 
00070   vtkSetClampMacro( ZeroNormalDiffuseIntensity,  float, 0.0, 1.0);
00071   vtkGetMacro( ZeroNormalDiffuseIntensity, float );
00072   vtkSetClampMacro( ZeroNormalSpecularIntensity, float, 0.0, 1.0);
00073   vtkGetMacro( ZeroNormalSpecularIntensity, float );
00075 
00077 
00078   void UpdateShadingTable( vtkRenderer *ren, vtkVolume *vol,
00079                            vtkEncodedGradientEstimator *gradest);
00081 
00083 
00084   float *GetRedDiffuseShadingTable(    vtkVolume *vol );
00085   float *GetGreenDiffuseShadingTable(  vtkVolume *vol );
00086   float *GetBlueDiffuseShadingTable(   vtkVolume *vol );
00087   float *GetRedSpecularShadingTable(   vtkVolume *vol );
00088   float *GetGreenSpecularShadingTable( vtkVolume *vol );
00089   float *GetBlueSpecularShadingTable(  vtkVolume *vol );
00091 
00092 protected:
00093   vtkEncodedGradientShader();
00094   ~vtkEncodedGradientShader();
00095 
00097 
00109   void  BuildShadingTable( int index,
00110                            float lightDirection[3],
00111                            float lightColor[3],
00112                            float lightIntensity,
00113                            float viewDirection[3],
00114                            float material[4],
00115                            int twoSided,
00116                            vtkEncodedGradientEstimator *gradest,
00117                            int updateFlag );
00119   
00120   // The six shading tables (r diffuse ,g diffuse ,b diffuse, 
00121   // r specular, g specular, b specular ) - with an entry for each
00122   // encoded normal plus one entry at the end for the zero normal
00123   // There is one shading table per volume listed in the ShadingTableVolume
00124   // array. A null entry indicates an available slot.
00125   float                        *ShadingTable[VTK_MAX_SHADING_TABLES][6];
00126   vtkVolume                    *ShadingTableVolume[VTK_MAX_SHADING_TABLES];
00127   int                          ShadingTableSize[VTK_MAX_SHADING_TABLES];
00128 
00129   // The intensity of light used for the zero normals, since it
00130   // can not be computed from the normal angles. Defaults to 0.0.
00131   float    ZeroNormalDiffuseIntensity;
00132   float    ZeroNormalSpecularIntensity;
00133 private:
00134   vtkEncodedGradientShader(const vtkEncodedGradientShader&);  // Not implemented.
00135   void operator=(const vtkEncodedGradientShader&);  // Not implemented.
00136 }; 
00137 
00138 
00139 #endif