VTK
vtkEncodedGradientShader.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkEncodedGradientShader.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 
32 #ifndef __vtkEncodedGradientShader_h
33 #define __vtkEncodedGradientShader_h
34 
35 #include "vtkObject.h"
36 
37 class vtkVolume;
38 class vtkRenderer;
40 
41 #define VTK_MAX_SHADING_TABLES 100
42 
44 {
45 public:
46  static vtkEncodedGradientShader *New();
48 
50  void PrintSelf( ostream& os, vtkIndent indent );
51 
53 
55  vtkSetClampMacro( ZeroNormalDiffuseIntensity, float, 0.0f, 1.0f);
56  vtkGetMacro( ZeroNormalDiffuseIntensity, float );
57  vtkSetClampMacro( ZeroNormalSpecularIntensity, float, 0.0f, 1.0f);
58  vtkGetMacro( ZeroNormalSpecularIntensity, float );
60 
62 
63  void UpdateShadingTable( vtkRenderer *ren, vtkVolume *vol,
66 
68 
69  float *GetRedDiffuseShadingTable( vtkVolume *vol );
70  float *GetGreenDiffuseShadingTable( vtkVolume *vol );
71  float *GetBlueDiffuseShadingTable( vtkVolume *vol );
72  float *GetRedSpecularShadingTable( vtkVolume *vol );
73  float *GetGreenSpecularShadingTable( vtkVolume *vol );
74  float *GetBlueSpecularShadingTable( vtkVolume *vol );
76 
78 
81  vtkSetClampMacro( ActiveComponent, int, 0, 3 );
82  vtkGetMacro( ActiveComponent, int );
84 
85 protected:
88 
90 
102  void BuildShadingTable( int index,
103  double lightDirection[3],
104  double lightAmbientColor[3],
105  double lightDiffuseColor[3],
106  double lightSpecularColor[3],
107  double lightIntensity,
108  double viewDirection[3],
109  double material[4],
110  int twoSided,
112  int updateFlag );
114 
115  // The six shading tables (r diffuse ,g diffuse ,b diffuse,
116  // r specular, g specular, b specular ) - with an entry for each
117  // encoded normal plus one entry at the end for the zero normal
118  // There is one shading table per volume listed in the ShadingTableVolume
119  // array. A null entry indicates an available slot.
120  float *ShadingTable[VTK_MAX_SHADING_TABLES][6];
121  vtkVolume *ShadingTableVolume[VTK_MAX_SHADING_TABLES];
122  int ShadingTableSize[VTK_MAX_SHADING_TABLES];
123 
125 
126  // The intensity of light used for the zero normals, since it
127  // can not be computed from the normal angles. Defaults to 0.0.
130 private:
131  vtkEncodedGradientShader(const vtkEncodedGradientShader&); // Not implemented.
132  void operator=(const vtkEncodedGradientShader&); // Not implemented.
133 };
134 
135 
136 #endif