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 =========================================================================*/
42 #ifndef vtkValuePass_h
43 #define vtkValuePass_h
44 
45 #include "vtkDeprecation.h" // for VTK_DEPRECATED_IN_9_0_0
46 #include "vtkOpenGLRenderPass.h"
47 #include "vtkRenderingOpenGL2Module.h" // For export macro
48 #include "vtkSmartPointer.h" //for ivar
49 
50 class vtkAbstractArray;
51 class vtkActor;
52 class vtkDataArray;
53 class vtkDataObject;
54 class vtkFloatArray;
55 class vtkMapper;
57 class vtkProperty;
58 class vtkRenderer;
59 class vtkRenderWindow;
60 class vtkShaderProgram;
61 
62 class VTKRENDERINGOPENGL2_EXPORT vtkValuePass : public vtkOpenGLRenderPass
63 {
64 public:
65  enum Mode
66  {
67  INVERTIBLE_LUT = 1,
68  FLOATING_POINT = 2
69  };
70 
71  static vtkValuePass* New();
73  void PrintSelf(ostream& os, vtkIndent indent) override;
74 
75  // @deprecated As of 9.0, We are moving to only FLOATING_POINT.
76  VTK_DEPRECATED_IN_9_0_0("Removed in 9.0 (only FLOATING_POINT is supported)")
77  vtkSetMacro(RenderingMode, int);
78  VTK_DEPRECATED_IN_9_0_0("Removed in 9.0 (only FLOATING_POINT is supported)")
79  vtkGetMacro(RenderingMode, int);
80  void SetInputArrayToProcess(int fieldAssociation, const char* name);
81  void SetInputArrayToProcess(int fieldAssociation, int fieldId);
82  void SetInputComponentToProcess(int component);
83  // @deprecated As of 9.0, Not needed with FLOATING_POINT.
84  VTK_DEPRECATED_IN_9_0_0("Removed in 9.0 (only FLOATING_POINT is supported)")
85  void SetScalarRange(double min, double max);
86 
91  void Render(const vtkRenderState* s) override;
92 
98  vtkFloatArray* GetFloatImageDataArray(vtkRenderer* ren);
99 
105  void GetFloatImageData(int const format, int const width, int const height, void* data);
106 
111  int* GetFloatImageExtents();
112 
117  VTK_DEPRECATED_IN_9_0_0("Removed in 9.0 (only FLOATING_POINT is supported)")
118  bool IsFloatingPointModeSupported();
119 
120  void ReleaseGraphicsResources(vtkWindow* win) override;
121 
127  VTK_DEPRECATED_IN_9_0_0("Removed in 9.0 (only FLOATING_POINT is supported)")
128  void ColorToValue(
129  unsigned char const* color, double const min, double const scale, double& value);
130 
131 protected:
133  ~vtkValuePass() override;
134 
136 
145  bool PostReplaceShaderValues(std::string& vertexShader, std::string& geometryShader,
146  std::string& fragmentShader, vtkAbstractMapper* mapper, vtkProp* prop) override;
151  bool SetShaderParameters(vtkShaderProgram* program, vtkAbstractMapper* mapper, vtkProp* prop,
152  vtkOpenGLVertexArrayObject* VAO = nullptr) override;
160  vtkMTimeType GetShaderStageMTime() override;
162 
167  void BeginPass(vtkRenderer* ren);
168 
172  void EndPass();
173 
178  void RenderOpaqueGeometry(const vtkRenderState* s);
179 
183  void RenderPieceFinish();
184 
188  void RenderPieceStart(vtkDataArray* dataArr, vtkMapper* m);
189 
194  void BeginMapperRender(vtkMapper* mapper, vtkDataArray* dataArray, vtkProperty* property);
195 
199  void EndMapperRender(vtkMapper* mapper, vtkProperty* property);
200 
201  void InitializeBuffers(vtkRenderer* ren);
202 
206  bool UpdateShaders(std::string& VSSource, std::string& FSSource);
207 
211  void BindAttributes(vtkShaderProgram* prog, vtkOpenGLVertexArrayObject* VAO);
212  void BindUniforms(vtkShaderProgram* prog);
213 
215 
218  bool HasWindowSizeChanged(vtkRenderer* ren);
219  bool InitializeFBO(vtkRenderer* ren);
220  void ReleaseFBO(vtkWindow* win);
222 
223  class vtkInternalsFloat;
224  vtkInternalsFloat* ImplFloat;
225 
226  class vtkInternalsInvertible;
227  vtkInternalsInvertible* ImplInv;
228 
229  struct Parameters;
230  Parameters* PassState;
231 
232  int RenderingMode;
233 
234 private:
235  vtkDataArray* GetCurrentArray(vtkMapper* mapper, Parameters* arrayPar);
236 
237  vtkAbstractArray* GetArrayFromCompositeData(vtkMapper* mapper, Parameters* arrayPar);
238 
239  vtkSmartPointer<vtkAbstractArray> MultiBlocksArray;
240 
241  void PopulateCellCellMap(const vtkRenderState* s);
242 
243  vtkValuePass(const vtkValuePass&) = delete;
244  void operator=(const vtkValuePass&) = delete;
245 };
246 
247 #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:46
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:50
general representation of visualization data
Definition: vtkDataObject.h:60
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:36
a simple class to control print indentation
Definition: vtkIndent.h:34
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:82
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:57
represent surface properties of a geometric object
Definition: vtkProperty.h:62
Context in which a vtkRenderPass will render.
create a window for renderers to draw into
abstract specification for renderers
Definition: vtkRenderer.h:73
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:63
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:39
@ 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)