VTK  9.3.0
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:
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 
60 
62 
72 
74 
79  vtkSetClampMacro(ActiveComponent, int, 0, 3);
80  vtkGetMacro(ActiveComponent, int);
82 
83 protected:
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
Superclass for gradient estimation.
Compute shading tables for encoded normals.
float * GetRedSpecularShadingTable(vtkVolume *vol)
Get the red/green/blue shading table.
float * GetGreenSpecularShadingTable(vtkVolume *vol)
Get the red/green/blue shading table.
float * GetRedDiffuseShadingTable(vtkVolume *vol)
Get the red/green/blue shading table.
void PrintSelf(ostream &os, vtkIndent indent) override
Print the vtkEncodedGradientShader.
static vtkEncodedGradientShader * New()
float * GetGreenDiffuseShadingTable(vtkVolume *vol)
Get the red/green/blue shading table.
void UpdateShadingTable(vtkRenderer *ren, vtkVolume *vol, vtkEncodedGradientEstimator *gradest)
Cause the shading table to be updated.
~vtkEncodedGradientShader() override
float * GetBlueDiffuseShadingTable(vtkVolume *vol)
Get the red/green/blue shading table.
void BuildShadingTable(int index, double lightDirection[3], double lightAmbientColor[3], double lightDiffuseColor[3], double lightSpecularColor[3], double lightIntensity, double viewDirection[3], double material[4], int twoSided, vtkEncodedGradientEstimator *gradest, int updateFlag)
Build a shading table for a light with the specified direction, and color for an object of the specif...
float * GetBlueSpecularShadingTable(vtkVolume *vol)
Get the red/green/blue shading table.
a simple class to control print indentation
Definition: vtkIndent.h:29
abstract base class for most VTK objects
Definition: vtkObject.h:52
abstract specification for renderers
Definition: vtkRenderer.h:62
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:40
@ index
Definition: vtkX3D.h:246
#define VTK_MAX_SHADING_TABLES