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