VTK  9.1.0
vtkValuePass.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkValuePass.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 =========================================================================*/
61 #ifndef vtkValuePass_h
62 #define vtkValuePass_h
63 
64 #include "vtkDeprecation.h" // for VTK_DEPRECATED_IN_9_0_0
65 #include "vtkOpenGLRenderPass.h"
66 #include "vtkRenderingOpenGL2Module.h" // For export macro
67 #include "vtkSmartPointer.h" //for ivar
68 
69 class vtkAbstractArray;
70 class vtkActor;
71 class vtkDataArray;
72 class vtkDataObject;
73 class vtkFloatArray;
74 class vtkMapper;
76 class vtkProperty;
77 class vtkRenderer;
78 class vtkRenderWindow;
79 class vtkShaderProgram;
80 
81 class VTKRENDERINGOPENGL2_EXPORT vtkValuePass : public vtkOpenGLRenderPass
82 {
83 public:
84  enum Mode
85  {
86  INVERTIBLE_LUT = 1,
87  FLOATING_POINT = 2
88  };
89 
90  static vtkValuePass* New();
92  void PrintSelf(ostream& os, vtkIndent indent) override;
93 
94  // @deprecated As of 9.0, We are moving to only FLOATING_POINT.
95  VTK_DEPRECATED_IN_9_0_0("Removed in 9.0 (only FLOATING_POINT is supported)")
96  vtkSetMacro(RenderingMode, int);
97  VTK_DEPRECATED_IN_9_0_0("Removed in 9.0 (only FLOATING_POINT is supported)")
98  vtkGetMacro(RenderingMode, int);
99  void SetInputArrayToProcess(int fieldAssociation, const char* name);
100  void SetInputArrayToProcess(int fieldAssociation, int fieldId);
101  void SetInputComponentToProcess(int component);
102  // @deprecated As of 9.0, Not needed with FLOATING_POINT.
103  VTK_DEPRECATED_IN_9_0_0("Removed in 9.0 (only FLOATING_POINT is supported)")
104  void SetScalarRange(double min, double max);
105 
110  void Render(const vtkRenderState* s) override;
111 
117  vtkFloatArray* GetFloatImageDataArray(vtkRenderer* ren);
118 
124  void GetFloatImageData(int const format, int const width, int const height, void* data);
125 
130  int* GetFloatImageExtents();
131 
136  VTK_DEPRECATED_IN_9_0_0("Removed in 9.0 (only FLOATING_POINT is supported)")
137  bool IsFloatingPointModeSupported();
138 
139  void ReleaseGraphicsResources(vtkWindow* win) override;
140 
146  VTK_DEPRECATED_IN_9_0_0("Removed in 9.0 (only FLOATING_POINT is supported)")
147  void ColorToValue(
148  unsigned char const* color, double const min, double const scale, double& value);
149 
150 protected:
152  ~vtkValuePass() override;
153 
155 
164  bool PostReplaceShaderValues(std::string& vertexShader, std::string& geometryShader,
165  std::string& fragmentShader, vtkAbstractMapper* mapper, vtkProp* prop) override;
170  bool SetShaderParameters(vtkShaderProgram* program, vtkAbstractMapper* mapper, vtkProp* prop,
171  vtkOpenGLVertexArrayObject* VAO = nullptr) override;
179  vtkMTimeType GetShaderStageMTime() override;
181 
186  void BeginPass(vtkRenderer* ren);
187 
191  void EndPass();
192 
197  void RenderOpaqueGeometry(const vtkRenderState* s);
198 
202  void RenderPieceFinish();
203 
207  void RenderPieceStart(vtkDataArray* dataArr, vtkMapper* m);
208 
213  void BeginMapperRender(vtkMapper* mapper, vtkDataArray* dataArray, vtkProperty* property);
214 
218  void EndMapperRender(vtkMapper* mapper, vtkProperty* property);
219 
220  void InitializeBuffers(vtkRenderer* ren);
221 
225  bool UpdateShaders(std::string& VSSource, std::string& FSSource);
226 
230  void BindAttributes(vtkShaderProgram* prog, vtkOpenGLVertexArrayObject* VAO);
231  void BindUniforms(vtkShaderProgram* prog);
232 
234 
237  bool HasWindowSizeChanged(vtkRenderer* ren);
238  bool InitializeFBO(vtkRenderer* ren);
239  void ReleaseFBO(vtkWindow* win);
241 
242  class vtkInternalsFloat;
243  vtkInternalsFloat* ImplFloat;
244 
245  class vtkInternalsInvertible;
246  vtkInternalsInvertible* ImplInv;
247 
248  struct Parameters;
249  Parameters* PassState;
250 
251  int RenderingMode;
252 
253 private:
254  vtkDataArray* GetCurrentArray(vtkMapper* mapper, Parameters* arrayPar);
255 
256  vtkAbstractArray* GetArrayFromCompositeData(vtkMapper* mapper, Parameters* arrayPar);
257 
258  vtkSmartPointer<vtkAbstractArray> MultiBlocksArray;
259 
260  void PopulateCellCellMap(const vtkRenderState* s);
261 
262  vtkValuePass(const vtkValuePass&) = delete;
263  void operator=(const vtkValuePass&) = delete;
264 };
265 
266 #endif
Abstract superclass for all arrays.
abstract class specifies interface to map data
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:155
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:159
general representation of visualization data
dynamic, self-adjusting array of float
a simple class to control print indentation
Definition: vtkIndent.h:113
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:171
Abstract render pass with shader modifications.
The VertexArrayObject class uses, or emulates, vertex array objects.
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:67
represent surface properties of a geometric object
Definition: vtkProperty.h:171
Context in which a vtkRenderPass will render.
create a window for renderers to draw into
abstract specification for renderers
Definition: vtkRenderer.h:173
The ShaderProgram uses one or more Shader objects.
Hold a reference to a vtkObjectBase instance.
Renders geometry using the values of a field array as fragment colors.
Definition: vtkValuePass.h:82
static vtkValuePass * New()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
@ component
Definition: vtkX3D.h:181
@ value
Definition: vtkX3D.h:226
@ scale
Definition: vtkX3D.h:235
@ color
Definition: vtkX3D.h:227
@ height
Definition: vtkX3D.h:260
@ name
Definition: vtkX3D.h:225
@ data
Definition: vtkX3D.h:321
#define VTK_DEPRECATED_IN_9_0_0(reason)
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
#define max(a, b)