VTK  9.3.1
vtkEncodedGradientShader.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
3 
21 #ifndef vtkEncodedGradientShader_h
22 #define vtkEncodedGradientShader_h
23 
24 #include "vtkObject.h"
25 #include "vtkRenderingVolumeModule.h" // For export macro
26 
27 VTK_ABI_NAMESPACE_BEGIN
28 class vtkVolume;
29 class vtkRenderer;
31 
32 #define VTK_MAX_SHADING_TABLES 100
33 
34 class VTKRENDERINGVOLUME_EXPORT vtkEncodedGradientShader : public vtkObject
35 {
36 public:
37  static vtkEncodedGradientShader* New();
39 
43  void PrintSelf(ostream& os, vtkIndent indent) override;
44 
46 
50  vtkSetClampMacro(ZeroNormalDiffuseIntensity, float, 0.0f, 1.0f);
51  vtkGetMacro(ZeroNormalDiffuseIntensity, float);
52  vtkSetClampMacro(ZeroNormalSpecularIntensity, float, 0.0f, 1.0f);
53  vtkGetMacro(ZeroNormalSpecularIntensity, float);
55 
59  void UpdateShadingTable(vtkRenderer* ren, vtkVolume* vol, vtkEncodedGradientEstimator* gradest);
60 
62 
65  float* GetRedDiffuseShadingTable(vtkVolume* vol);
66  float* GetGreenDiffuseShadingTable(vtkVolume* vol);
67  float* GetBlueDiffuseShadingTable(vtkVolume* vol);
68  float* GetRedSpecularShadingTable(vtkVolume* vol);
69  float* GetGreenSpecularShadingTable(vtkVolume* vol);
70  float* GetBlueSpecularShadingTable(vtkVolume* vol);
72 
74 
79  vtkSetClampMacro(ActiveComponent, int, 0, 3);
80  vtkGetMacro(ActiveComponent, int);
82 
83 protected:
85  ~vtkEncodedGradientShader() override;
86 
101  void BuildShadingTable(int index, double lightDirection[3], double lightAmbientColor[3],
102  double lightDiffuseColor[3], double lightSpecularColor[3], double lightIntensity,
103  double viewDirection[3], double material[4], int twoSided, vtkEncodedGradientEstimator* gradest,
104  int updateFlag);
105 
106  // The six shading tables (r diffuse ,g diffuse ,b diffuse,
107  // r specular, g specular, b specular ) - with an entry for each
108  // encoded normal plus one entry at the end for the zero normal
109  // There is one shading table per volume listed in the ShadingTableVolume
110  // array. A null entry indicates an available slot.
111  float* ShadingTable[VTK_MAX_SHADING_TABLES][6];
112  vtkVolume* ShadingTableVolume[VTK_MAX_SHADING_TABLES];
113  int ShadingTableSize[VTK_MAX_SHADING_TABLES];
114 
116 
117  // The intensity of light used for the zero normals, since it
118  // can not be computed from the normal angles. Defaults to 0.0.
121 
122 private:
124  void operator=(const vtkEncodedGradientShader&) = delete;
125 };
126 
127 VTK_ABI_NAMESPACE_END
128 #endif
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:39
abstract base class for most VTK objects
Definition: vtkObject.h:51
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
abstract specification for renderers
Definition: vtkRenderer.h:61
a simple class to control print indentation
Definition: vtkIndent.h:28
Superclass for gradient estimation.
Compute shading tables for encoded normals.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
#define VTK_MAX_SHADING_TABLES