VTK  9.0.1
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 "vtkOpenGLRenderPass.h"
46 #include "vtkRenderingOpenGL2Module.h" // For export macro
47 #include "vtkSmartPointer.h" //for ivar
48 
49 class vtkAbstractArray;
50 class vtkActor;
51 class vtkDataArray;
52 class vtkDataObject;
53 class vtkFloatArray;
54 class vtkMapper;
56 class vtkProperty;
57 class vtkRenderer;
58 class vtkRenderWindow;
59 class vtkShaderProgram;
60 
61 class VTKRENDERINGOPENGL2_EXPORT vtkValuePass : public vtkOpenGLRenderPass
62 {
63 public:
64  enum Mode
65  {
66  INVERTIBLE_LUT = 1,
67  FLOATING_POINT = 2
68  };
69 
70  static vtkValuePass* New();
72  void PrintSelf(ostream& os, vtkIndent indent) override;
73 
74  // @deprecated As of 9.0, We are moving to only FLOATING_POINT.
75  VTK_LEGACY(vtkSetMacro(RenderingMode, int));
76  VTK_LEGACY(vtkGetMacro(RenderingMode, int));
77  void SetInputArrayToProcess(int fieldAssociation, const char* name);
78  void SetInputArrayToProcess(int fieldAssociation, int fieldId);
80  // @deprecated As of 9.0, Not needed with FLOATING_POINT.
81  VTK_LEGACY(void SetScalarRange(double min, double max));
82 
87  void Render(const vtkRenderState* s) override;
88 
95 
101  void GetFloatImageData(int const format, int const width, int const height, void* data);
102 
108 
113  VTK_LEGACY(bool IsFloatingPointModeSupported());
114 
115  void ReleaseGraphicsResources(vtkWindow* win) override;
116 
122  VTK_LEGACY(void ColorToValue(
123  unsigned char const* color, double const min, double const scale, double& value));
124 
125 protected:
127  ~vtkValuePass() override;
128 
130 
139  bool PostReplaceShaderValues(std::string& vertexShader, std::string& geometryShader,
140  std::string& fragmentShader, vtkAbstractMapper* mapper, vtkProp* prop) override;
146  vtkOpenGLVertexArrayObject* VAO = nullptr) override;
156 
161  void BeginPass(vtkRenderer* ren);
162 
166  void EndPass();
167 
173 
178 
183 
188  void BeginMapperRender(vtkMapper* mapper, vtkDataArray* dataArray, vtkProperty* property);
189 
193  void EndMapperRender(vtkMapper* mapper, vtkProperty* property);
194 
196 
200  bool UpdateShaders(std::string& VSSource, std::string& FSSource);
201 
207 
209 
214  void ReleaseFBO(vtkWindow* win);
216 
217  class vtkInternalsFloat;
218  vtkInternalsFloat* ImplFloat;
219 
220  class vtkInternalsInvertible;
221  vtkInternalsInvertible* ImplInv;
222 
223  struct Parameters;
224  Parameters* PassState;
225 
227 
228 private:
229  vtkDataArray* GetCurrentArray(vtkMapper* mapper, Parameters* arrayPar);
230 
231  vtkAbstractArray* GetArrayFromCompositeData(vtkMapper* mapper, Parameters* arrayPar);
232 
233  vtkSmartPointer<vtkAbstractArray> MultiBlocksArray;
234 
235  void PopulateCellCellMap(const vtkRenderState* s);
236 
237  vtkValuePass(const vtkValuePass&) = delete;
238  void operator=(const vtkValuePass&) = delete;
239 };
240 
241 #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:81
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:48
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:59
The ShaderProgram uses one or more Shader objects.
Renders geometry using the values of a field array as fragment colors.
Definition: vtkValuePass.h:62
void ReleaseGraphicsResources(vtkWindow *win) override
Release graphics resources and ask components to release their own resources.
void BindUniforms(vtkShaderProgram *prog)
void ReleaseFBO(vtkWindow *win)
void RenderOpaqueGeometry(const vtkRenderState *s)
Opaque pass with key checking.
bool InitializeFBO(vtkRenderer *ren)
bool IsFloatingPointModeSupported()
Check for extension support.
void RenderPieceFinish()
Unbind textures, etc.
void BindAttributes(vtkShaderProgram *prog, vtkOpenGLVertexArrayObject *VAO)
Bind shader variables.
bool HasWindowSizeChanged(vtkRenderer *ren)
Methods managing graphics resources required during FLOATING_POINT mode.
static vtkValuePass * New()
void RenderPieceStart(vtkDataArray *dataArr, vtkMapper *m)
Upload new data if necessary, bind textures, etc.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void InitializeBuffers(vtkRenderer *ren)
int * GetFloatImageExtents()
Interface to get the rendered image in FLOATING_POINT mode.
void EndPass()
Unbinds internal FBO when FLOATING_POINT mode is enabled.
bool PostReplaceShaderValues(std::string &vertexShader, std::string &geometryShader, std::string &fragmentShader, vtkAbstractMapper *mapper, vtkProp *prop) override
vtkOpenGLRenderPass API.
void Render(const vtkRenderState *s) override
Perform rendering according to a render state s.
bool SetShaderParameters(vtkShaderProgram *program, vtkAbstractMapper *mapper, vtkProp *prop, vtkOpenGLVertexArrayObject *VAO=nullptr) override
Update the uniforms of the shader program.
vtkInternalsFloat * ImplFloat
Definition: vtkValuePass.h:217
void EndMapperRender(vtkMapper *mapper, vtkProperty *property)
Revert any changes made in BeginMapperRender.
bool UpdateShaders(std::string &VSSource, std::string &FSSource)
Add necessary shader definitions.
void GetFloatImageData(int const format, int const width, int const height, void *data)
Interface to get the rendered image in FLOATING_POINT mode.
void SetInputArrayToProcess(int fieldAssociation, int fieldId)
~vtkValuePass() override
void SetInputArrayToProcess(int fieldAssociation, const char *name)
void BeginPass(vtkRenderer *ren)
Manages graphics resources depending on the rendering mode.
vtkFloatArray * GetFloatImageDataArray(vtkRenderer *ren)
Interface to get the rendered image in FLOATING_POINT mode.
vtkInternalsInvertible * ImplInv
Definition: vtkValuePass.h:220
Parameters * PassState
Definition: vtkValuePass.h:223
void BeginMapperRender(vtkMapper *mapper, vtkDataArray *dataArray, vtkProperty *property)
Setup the mapper state, buffer objects or property variables necessary to render the active rendering...
void SetScalarRange(double min, double max)
vtkMTimeType GetShaderStageMTime() override
For multi-stage render passes that need to change shader code during a single pass,...
void SetInputComponentToProcess(int component)
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
@ 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
@ string
Definition: vtkX3D.h:496
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:293
#define max(a, b)