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=========================================================================*/
51#ifndef vtkValuePass_h
52#define vtkValuePass_h
53
54#include "vtkDeprecation.h" // for VTK_DEPRECATED_IN_9_0_0
55#include "vtkOpenGLRenderPass.h"
56#include "vtkRenderingOpenGL2Module.h" // For export macro
57#include "vtkSmartPointer.h" //for ivar
58
60class vtkActor;
61class vtkDataArray;
62class vtkDataObject;
63class vtkFloatArray;
64class vtkMapper;
66class vtkProperty;
67class vtkRenderer;
68class vtkRenderWindow;
70
71class VTKRENDERINGOPENGL2_EXPORT vtkValuePass : public vtkOpenGLRenderPass
72{
73public:
74 enum Mode
75 {
76 INVERTIBLE_LUT = 1,
77 FLOATING_POINT = 2
78 };
79
80 static vtkValuePass* New();
82 void PrintSelf(ostream& os, vtkIndent indent) override;
83
84 // @deprecated As of 9.0, We are moving to only FLOATING_POINT.
85 VTK_DEPRECATED_IN_9_0_0("Removed in 9.0 (only FLOATING_POINT is supported)")
86 vtkSetMacro(RenderingMode, int);
87 VTK_DEPRECATED_IN_9_0_0("Removed in 9.0 (only FLOATING_POINT is supported)")
88 vtkGetMacro(RenderingMode, int);
89 void SetInputArrayToProcess(int fieldAssociation, const char* name);
90 void SetInputArrayToProcess(int fieldAssociation, int fieldId);
91 void SetInputComponentToProcess(int component);
92 // @deprecated As of 9.0, Not needed with FLOATING_POINT.
93 VTK_DEPRECATED_IN_9_0_0("Removed in 9.0 (only FLOATING_POINT is supported)")
94 void SetScalarRange(double min, double max);
95
100 void Render(const vtkRenderState* s) override;
101
107 vtkFloatArray* GetFloatImageDataArray(vtkRenderer* ren);
108
114 void GetFloatImageData(int const format, int const width, int const height, void* data);
115
120 int* GetFloatImageExtents();
121
126 VTK_DEPRECATED_IN_9_0_0("Removed in 9.0 (only FLOATING_POINT is supported)")
127 bool IsFloatingPointModeSupported();
128
129 void ReleaseGraphicsResources(vtkWindow* win) override;
130
136 VTK_DEPRECATED_IN_9_0_0("Removed in 9.0 (only FLOATING_POINT is supported)")
137 void ColorToValue(
138 unsigned char const* color, double const min, double const scale, double& value);
139
140protected:
142 ~vtkValuePass() override;
143
145
154 bool PostReplaceShaderValues(std::string& vertexShader, std::string& geometryShader,
155 std::string& fragmentShader, vtkAbstractMapper* mapper, vtkProp* prop) override;
160 bool SetShaderParameters(vtkShaderProgram* program, vtkAbstractMapper* mapper, vtkProp* prop,
161 vtkOpenGLVertexArrayObject* VAO = nullptr) override;
169 vtkMTimeType GetShaderStageMTime() override;
171
176 void BeginPass(vtkRenderer* ren);
177
181 void EndPass();
182
187 void RenderOpaqueGeometry(const vtkRenderState* s);
188
192 void RenderPieceFinish();
193
197 void RenderPieceStart(vtkDataArray* dataArr, vtkMapper* m);
198
203 void BeginMapperRender(vtkMapper* mapper, vtkDataArray* dataArray, vtkProperty* property);
204
208 void EndMapperRender(vtkMapper* mapper, vtkProperty* property);
209
210 void InitializeBuffers(vtkRenderer* ren);
211
215 bool UpdateShaders(std::string& VSSource, std::string& FSSource);
216
220 void BindAttributes(vtkShaderProgram* prog, vtkOpenGLVertexArrayObject* VAO);
221 void BindUniforms(vtkShaderProgram* prog);
222
224
227 bool HasWindowSizeChanged(vtkRenderer* ren);
228 bool InitializeFBO(vtkRenderer* ren);
229 void ReleaseFBO(vtkWindow* win);
231
232 class vtkInternalsFloat;
233 vtkInternalsFloat* ImplFloat;
234
235 class vtkInternalsInvertible;
236 vtkInternalsInvertible* ImplInv;
237
238 struct Parameters;
239 Parameters* PassState;
240
241 int RenderingMode;
242
243private:
244 vtkDataArray* GetCurrentArray(vtkMapper* mapper, Parameters* arrayPar);
245
246 vtkAbstractArray* GetArrayFromCompositeData(vtkMapper* mapper, Parameters* arrayPar);
247
248 vtkSmartPointer<vtkAbstractArray> MultiBlocksArray;
249
250 void PopulateCellCellMap(const vtkRenderState* s);
251
252 vtkValuePass(const vtkValuePass&) = delete;
253 void operator=(const vtkValuePass&) = delete;
254};
255
256#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:55
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:59
general representation of visualization data
Definition: vtkDataObject.h:69
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:45
a simple class to control print indentation
Definition: vtkIndent.h:43
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:91
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:71
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:72
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:45
@ 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)