VTK  9.2.6
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 =========================================================================*/
45 #ifndef vtkValuePass_h
46 #define vtkValuePass_h
47 
48 #include "vtkOpenGLRenderPass.h"
49 #include "vtkRenderingOpenGL2Module.h" // For export macro
50 #include "vtkSmartPointer.h" //for ivar
51 
52 class vtkAbstractArray;
53 class vtkActor;
54 class vtkDataArray;
55 class vtkDataObject;
56 class vtkFloatArray;
57 class vtkMapper;
59 class vtkProperty;
60 class vtkRenderer;
61 class vtkRenderWindow;
62 class vtkShaderProgram;
63 
64 class VTKRENDERINGOPENGL2_EXPORT vtkValuePass : public vtkOpenGLRenderPass
65 {
66 public:
67  enum Mode
68  {
69  INVERTIBLE_LUT = 1,
70  FLOATING_POINT = 2
71  };
72 
73  static vtkValuePass* New();
75  void PrintSelf(ostream& os, vtkIndent indent) override;
76 
77  void SetInputArrayToProcess(int fieldAssociation, const char* name);
78  void SetInputArrayToProcess(int fieldAssociation, int fieldId);
79  void SetInputComponentToProcess(int component);
80 
85  void Render(const vtkRenderState* s) override;
86 
92  vtkFloatArray* GetFloatImageDataArray(vtkRenderer* ren);
93 
99  void GetFloatImageData(int const format, int const width, int const height, void* data);
100 
105  int* GetFloatImageExtents();
106 
107  void ReleaseGraphicsResources(vtkWindow* win) override;
108 
109 protected:
110  vtkValuePass();
111  ~vtkValuePass() override;
112 
114 
123  bool PostReplaceShaderValues(std::string& vertexShader, std::string& geometryShader,
124  std::string& fragmentShader, vtkAbstractMapper* mapper, vtkProp* prop) override;
129  bool SetShaderParameters(vtkShaderProgram* program, vtkAbstractMapper* mapper, vtkProp* prop,
130  vtkOpenGLVertexArrayObject* VAO = nullptr) override;
140 
145  void BeginPass(vtkRenderer* ren);
146 
150  void EndPass();
151 
156  void RenderOpaqueGeometry(const vtkRenderState* s);
157 
161  void RenderPieceFinish();
162 
166  void RenderPieceStart(vtkDataArray* dataArr, vtkMapper* m);
167 
172  void BeginMapperRender(vtkMapper* mapper, vtkDataArray* dataArray, vtkProperty* property);
173 
177  void EndMapperRender(vtkMapper* mapper, vtkProperty* property);
178 
179  void InitializeBuffers(vtkRenderer* ren);
180 
184  bool UpdateShaders(std::string& VSSource, std::string& FSSource);
185 
189  void BindAttributes(vtkShaderProgram* prog, vtkOpenGLVertexArrayObject* VAO);
190  void BindUniforms(vtkShaderProgram* prog);
191 
193 
196  bool HasWindowSizeChanged(vtkRenderer* ren);
197  bool InitializeFBO(vtkRenderer* ren);
198  void ReleaseFBO(vtkWindow* win);
200 
201  class vtkInternalsFloat;
202  vtkInternalsFloat* ImplFloat;
203 
204  class vtkInternalsInvertible;
205  vtkInternalsInvertible* ImplInv;
206 
207  struct Parameters;
208  Parameters* PassState;
209 
211 
212 private:
213  vtkDataArray* GetCurrentArray(vtkMapper* mapper, Parameters* arrayPar);
214 
215  vtkAbstractArray* GetArrayFromCompositeData(vtkMapper* mapper, Parameters* arrayPar);
216 
217  vtkSmartPointer<vtkAbstractArray> MultiBlocksArray;
218 
219  void PopulateCellCellMap(const vtkRenderState* s);
220 
221  vtkValuePass(const vtkValuePass&) = delete;
222  void operator=(const vtkValuePass&) = delete;
223 };
224 
225 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:56
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
represent surface properties of a geometric object
Definition: vtkProperty.h:67
Abstract superclass for all arrays.
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:41
Parameters * PassState
Definition: vtkValuePass.h:207
abstract specification for renderers
Definition: vtkRenderer.h:72
vtkInternalsFloat * ImplFloat
Definition: vtkValuePass.h:201
window superclass for vtkRenderWindow
Definition: vtkWindow.h:38
Context in which a vtkRenderPass will render.
a simple class to control print indentation
Definition: vtkIndent.h:39
The VertexArrayObject class uses, or emulates, vertex array objects.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
Renders geometry using the values of a field array as fragment colors.
Definition: vtkValuePass.h:64
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:87
abstract class specifies interface to map data
create a window for renderers to draw into
virtual void Render(const vtkRenderState *s)=0
Perform rendering according to a render state s.
virtual vtkMTimeType GetShaderStageMTime()
For multi-stage render passes that need to change shader code during a single pass, use this method to notify a mapper that the shader needs to be rebuilt (rather than reuse the last cached shader.
vtkInternalsInvertible * ImplInv
Definition: vtkValuePass.h:204
virtual void ReleaseGraphicsResources(vtkWindow *w)
Release graphics resources and ask components to release their own resources.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
virtual bool SetShaderParameters(vtkShaderProgram *program, vtkAbstractMapper *mapper, vtkProp *prop, vtkOpenGLVertexArrayObject *VAO=nullptr)
Update the uniforms of the shader program.
Abstract render pass with shader modifications.
virtual bool PostReplaceShaderValues(std::string &vertexShader, std::string &geometryShader, std::string &fragmentShader, vtkAbstractMapper *mapper, vtkProp *prop)
Use vtkShaderProgram::Substitute to replace.
general representation of visualization data
Definition: vtkDataObject.h:65
The ShaderProgram uses one or more Shader objects.