VTK
|
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 00032 #ifndef __vtkEncodedGradientShader_h 00033 #define __vtkEncodedGradientShader_h 00034 00035 #include "vtkObject.h" 00036 00037 class vtkVolume; 00038 class vtkRenderer; 00039 class vtkEncodedGradientEstimator; 00040 00041 #define VTK_MAX_SHADING_TABLES 100 00042 00043 class VTK_VOLUMERENDERING_EXPORT vtkEncodedGradientShader : public vtkObject 00044 { 00045 public: 00046 static vtkEncodedGradientShader *New(); 00047 vtkTypeRevisionMacro(vtkEncodedGradientShader,vtkObject); 00048 00050 void PrintSelf( ostream& os, vtkIndent indent ); 00051 00053 00055 vtkSetClampMacro( ZeroNormalDiffuseIntensity, float, 0.0, 1.0); 00056 vtkGetMacro( ZeroNormalDiffuseIntensity, float ); 00057 vtkSetClampMacro( ZeroNormalSpecularIntensity, float, 0.0, 1.0); 00058 vtkGetMacro( ZeroNormalSpecularIntensity, float ); 00060 00062 00063 void UpdateShadingTable( vtkRenderer *ren, vtkVolume *vol, 00064 vtkEncodedGradientEstimator *gradest); 00066 00068 00069 float *GetRedDiffuseShadingTable( vtkVolume *vol ); 00070 float *GetGreenDiffuseShadingTable( vtkVolume *vol ); 00071 float *GetBlueDiffuseShadingTable( vtkVolume *vol ); 00072 float *GetRedSpecularShadingTable( vtkVolume *vol ); 00073 float *GetGreenSpecularShadingTable( vtkVolume *vol ); 00074 float *GetBlueSpecularShadingTable( vtkVolume *vol ); 00076 00078 00081 vtkSetClampMacro( ActiveComponent, int, 0, 3 ); 00082 vtkGetMacro( ActiveComponent, int ); 00084 00085 protected: 00086 vtkEncodedGradientShader(); 00087 ~vtkEncodedGradientShader(); 00088 00090 00102 void BuildShadingTable( int index, 00103 double lightDirection[3], 00104 double lightColor[3], 00105 double lightIntensity, 00106 double viewDirection[3], 00107 double material[4], 00108 int twoSided, 00109 vtkEncodedGradientEstimator *gradest, 00110 int updateFlag ); 00112 00113 // The six shading tables (r diffuse ,g diffuse ,b diffuse, 00114 // r specular, g specular, b specular ) - with an entry for each 00115 // encoded normal plus one entry at the end for the zero normal 00116 // There is one shading table per volume listed in the ShadingTableVolume 00117 // array. A null entry indicates an available slot. 00118 float *ShadingTable[VTK_MAX_SHADING_TABLES][6]; 00119 vtkVolume *ShadingTableVolume[VTK_MAX_SHADING_TABLES]; 00120 int ShadingTableSize[VTK_MAX_SHADING_TABLES]; 00121 00122 int ActiveComponent; 00123 00124 // The intensity of light used for the zero normals, since it 00125 // can not be computed from the normal angles. Defaults to 0.0. 00126 float ZeroNormalDiffuseIntensity; 00127 float ZeroNormalSpecularIntensity; 00128 private: 00129 vtkEncodedGradientShader(const vtkEncodedGradientShader&); // Not implemented. 00130 void operator=(const vtkEncodedGradientShader&); // Not implemented. 00131 }; 00132 00133 00134 #endif