VTK  9.3.0
vtkValuePass.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
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 VTK_ABI_NAMESPACE_BEGIN
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  void SetInputArrayToProcess(int fieldAssociation, const char* name);
76  void SetInputArrayToProcess(int fieldAssociation, int fieldId);
78 
83  void Render(const vtkRenderState* s) override;
84 
91 
97  void GetFloatImageData(int format, int width, int height, void* data);
98 
104 
105  void ReleaseGraphicsResources(vtkWindow* win) override;
106 
107 protected:
109  ~vtkValuePass() override;
110 
112 
121  bool PostReplaceShaderValues(std::string& vertexShader, std::string& geometryShader,
122  std::string& fragmentShader, vtkAbstractMapper* mapper, vtkProp* prop) override;
128  vtkOpenGLVertexArrayObject* VAO = nullptr) override;
138 
143  void BeginPass(vtkRenderer* ren);
144 
148  void EndPass();
149 
155 
160 
165 
170  void BeginMapperRender(vtkMapper* mapper, vtkDataArray* dataArray, vtkProperty* property);
171 
175  void EndMapperRender(vtkMapper* mapper, vtkProperty* property);
176 
178 
182  bool UpdateShaders(std::string& VSSource, std::string& FSSource);
183 
189 
191 
196  void ReleaseFBO(vtkWindow* win);
198 
199  class vtkInternalsFloat;
200  vtkInternalsFloat* ImplFloat;
201 
202  class vtkInternalsInvertible;
203  vtkInternalsInvertible* ImplInv;
204 
205  struct Parameters;
206  Parameters* PassState;
207 
209 
210 private:
211  vtkDataArray* GetCurrentArray(vtkMapper* mapper, Parameters* arrayPar);
212 
213  vtkAbstractArray* GetArrayFromCompositeData(vtkMapper* mapper, Parameters* arrayPar);
214 
215  vtkSmartPointer<vtkAbstractArray> MultiBlocksArray;
216 
217  void PopulateCellCellMap(const vtkRenderState* s);
218 
219  vtkValuePass(const vtkValuePass&) = delete;
220  void operator=(const vtkValuePass&) = delete;
221 };
222 
223 VTK_ABI_NAMESPACE_END
224 #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:50
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
general representation of visualization data
Definition: vtkDataObject.h:64
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:40
a simple class to control print indentation
Definition: vtkIndent.h:38
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:86
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:55
represent surface properties of a geometric object
Definition: vtkProperty.h:66
Context in which a vtkRenderPass will render.
create a window for renderers to draw into
abstract specification for renderers
Definition: vtkRenderer.h:71
The ShaderProgram uses one or more Shader objects.
Renders geometry using the values of a field array as fragment colors.
Definition: vtkValuePass.h:63
void ReleaseGraphicsResources(vtkWindow *win) override
Release graphics resources and ask components to release their own resources.
void BindUniforms(vtkShaderProgram *prog)
void ReleaseFBO(vtkWindow *win)
Methods managing graphics resources required during FLOATING_POINT mode.
void RenderOpaqueGeometry(const vtkRenderState *s)
Opaque pass with key checking.
bool InitializeFBO(vtkRenderer *ren)
Methods managing graphics resources required during FLOATING_POINT mode.
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.
void GetFloatImageData(int format, int width, int height, void *data)
Interface to get the rendered image in FLOATING_POINT mode.
bool SetShaderParameters(vtkShaderProgram *program, vtkAbstractMapper *mapper, vtkProp *prop, vtkOpenGLVertexArrayObject *VAO=nullptr) override
Update the uniforms of the shader program.
vtkInternalsFloat * ImplFloat
Definition: vtkValuePass.h:199
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 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:202
Parameters * PassState
Definition: vtkValuePass.h:205
void BeginMapperRender(vtkMapper *mapper, vtkDataArray *dataArray, vtkProperty *property)
Setup the mapper state, buffer objects or property variables necessary to render the active rendering...
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:37
@ component
Definition: vtkX3D.h:175
@ height
Definition: vtkX3D.h:254
@ name
Definition: vtkX3D.h:219
@ data
Definition: vtkX3D.h:315
@ string
Definition: vtkX3D.h:490
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270