VTK  9.2.5
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 =========================================================================*/
64 #ifndef vtkValuePass_h
65 #define vtkValuePass_h
66 
67 #include "vtkOpenGLRenderPass.h"
68 #include "vtkRenderingOpenGL2Module.h" // For export macro
69 #include "vtkSmartPointer.h" //for ivar
70 
71 class vtkAbstractArray;
72 class vtkActor;
73 class vtkDataArray;
74 class vtkDataObject;
75 class vtkFloatArray;
76 class vtkMapper;
78 class vtkProperty;
79 class vtkRenderer;
80 class vtkRenderWindow;
81 class vtkShaderProgram;
82 
83 class VTKRENDERINGOPENGL2_EXPORT vtkValuePass : public vtkOpenGLRenderPass
84 {
85 public:
86  enum Mode
87  {
88  INVERTIBLE_LUT = 1,
89  FLOATING_POINT = 2
90  };
91 
92  static vtkValuePass* New();
94  void PrintSelf(ostream& os, vtkIndent indent) override;
95 
96  void SetInputArrayToProcess(int fieldAssociation, const char* name);
97  void SetInputArrayToProcess(int fieldAssociation, int fieldId);
99 
104  void Render(const vtkRenderState* s) override;
105 
112 
118  void GetFloatImageData(int const format, int const width, int const height, void* data);
119 
125 
126  void ReleaseGraphicsResources(vtkWindow* win) override;
127 
128 protected:
130  ~vtkValuePass() override;
131 
133 
142  bool PostReplaceShaderValues(std::string& vertexShader, std::string& geometryShader,
143  std::string& fragmentShader, vtkAbstractMapper* mapper, vtkProp* prop) override;
149  vtkOpenGLVertexArrayObject* VAO = nullptr) override;
159 
164  void BeginPass(vtkRenderer* ren);
165 
169  void EndPass();
170 
176 
181 
186 
191  void BeginMapperRender(vtkMapper* mapper, vtkDataArray* dataArray, vtkProperty* property);
192 
196  void EndMapperRender(vtkMapper* mapper, vtkProperty* property);
197 
199 
203  bool UpdateShaders(std::string& VSSource, std::string& FSSource);
204 
210 
212 
217  void ReleaseFBO(vtkWindow* win);
219 
220  class vtkInternalsFloat;
221  vtkInternalsFloat* ImplFloat;
222 
223  class vtkInternalsInvertible;
224  vtkInternalsInvertible* ImplInv;
225 
226  struct Parameters;
227  Parameters* PassState;
228 
230 
231 private:
232  vtkDataArray* GetCurrentArray(vtkMapper* mapper, Parameters* arrayPar);
233 
234  vtkAbstractArray* GetArrayFromCompositeData(vtkMapper* mapper, Parameters* arrayPar);
235 
236  vtkSmartPointer<vtkAbstractArray> MultiBlocksArray;
237 
238  void PopulateCellCellMap(const vtkRenderState* s);
239 
240  vtkValuePass(const vtkValuePass&) = delete;
241  void operator=(const vtkValuePass&) = delete;
242 };
243 
244 #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:161
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:165
general representation of visualization data
dynamic, self-adjusting array of float
a simple class to control print indentation
Definition: vtkIndent.h:119
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:177
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:76
represent surface properties of a geometric object
Definition: vtkProperty.h:177
Context in which a vtkRenderPass will render.
create a window for renderers to draw into
abstract specification for renderers
Definition: vtkRenderer.h:182
The ShaderProgram uses one or more Shader objects.
Renders geometry using the values of a field array as fragment colors.
Definition: vtkValuePass.h:84
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:220
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:223
Parameters * PassState
Definition: vtkValuePass.h:226
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:39
@ 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