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 =========================================================================*/
54 #ifndef vtkValuePass_h
55 #define vtkValuePass_h
56 
57 #include "vtkOpenGLRenderPass.h"
58 #include "vtkRenderingOpenGL2Module.h" // For export macro
59 #include "vtkSmartPointer.h" //for ivar
60 
61 class vtkAbstractArray;
62 class vtkActor;
63 class vtkDataArray;
64 class vtkDataObject;
65 class vtkFloatArray;
66 class vtkMapper;
68 class vtkProperty;
69 class vtkRenderer;
70 class vtkRenderWindow;
71 class vtkShaderProgram;
72 
73 class VTKRENDERINGOPENGL2_EXPORT vtkValuePass : public vtkOpenGLRenderPass
74 {
75 public:
76  enum Mode
77  {
78  INVERTIBLE_LUT = 1,
79  FLOATING_POINT = 2
80  };
81 
82  static vtkValuePass* New();
84  void PrintSelf(ostream& os, vtkIndent indent) override;
85 
86  void SetInputArrayToProcess(int fieldAssociation, const char* name);
87  void SetInputArrayToProcess(int fieldAssociation, int fieldId);
89 
94  void Render(const vtkRenderState* s) override;
95 
102 
108  void GetFloatImageData(int const format, int const width, int const height, void* data);
109 
115 
116  void ReleaseGraphicsResources(vtkWindow* win) override;
117 
118 protected:
120  ~vtkValuePass() override;
121 
123 
132  bool PostReplaceShaderValues(std::string& vertexShader, std::string& geometryShader,
133  std::string& fragmentShader, vtkAbstractMapper* mapper, vtkProp* prop) override;
139  vtkOpenGLVertexArrayObject* VAO = nullptr) override;
149 
154  void BeginPass(vtkRenderer* ren);
155 
159  void EndPass();
160 
166 
171 
176 
181  void BeginMapperRender(vtkMapper* mapper, vtkDataArray* dataArray, vtkProperty* property);
182 
186  void EndMapperRender(vtkMapper* mapper, vtkProperty* property);
187 
189 
193  bool UpdateShaders(std::string& VSSource, std::string& FSSource);
194 
200 
202 
207  void ReleaseFBO(vtkWindow* win);
209 
210  class vtkInternalsFloat;
211  vtkInternalsFloat* ImplFloat;
212 
213  class vtkInternalsInvertible;
214  vtkInternalsInvertible* ImplInv;
215 
216  struct Parameters;
217  Parameters* PassState;
218 
220 
221 private:
222  vtkDataArray* GetCurrentArray(vtkMapper* mapper, Parameters* arrayPar);
223 
224  vtkAbstractArray* GetArrayFromCompositeData(vtkMapper* mapper, Parameters* arrayPar);
225 
226  vtkSmartPointer<vtkAbstractArray> MultiBlocksArray;
227 
228  void PopulateCellCellMap(const vtkRenderState* s);
229 
230  vtkValuePass(const vtkValuePass&) = delete;
231  void operator=(const vtkValuePass&) = delete;
232 };
233 
234 #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:61
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:65
general representation of visualization data
Definition: vtkDataObject.h:75
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:51
a simple class to control print indentation
Definition: vtkIndent.h:49
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:97
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:66
represent surface properties of a geometric object
Definition: vtkProperty.h:77
Context in which a vtkRenderPass will render.
create a window for renderers to draw into
abstract specification for renderers
Definition: vtkRenderer.h:82
The ShaderProgram uses one or more Shader objects.
Renders geometry using the values of a field array as fragment colors.
Definition: vtkValuePass.h:74
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.
bool SetShaderParameters(vtkShaderProgram *program, vtkAbstractMapper *mapper, vtkProp *prop, vtkOpenGLVertexArrayObject *VAO=nullptr) override
Update the uniforms of the shader program.
vtkInternalsFloat * ImplFloat
Definition: vtkValuePass.h:210
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:213
Parameters * PassState
Definition: vtkValuePass.h:216
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:48
@ component
Definition: vtkX3D.h:181
@ 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:287