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);
79  void SetInputComponentToProcess(int component);
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 
94  vtkFloatArray* GetFloatImageDataArray(vtkRenderer* ren);
95 
101  void GetFloatImageData(int const format, int const width, int const height, void* data);
102 
107  int* GetFloatImageExtents();
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:
126  vtkValuePass();
127  ~vtkValuePass() override;
128 
130 
139  bool PostReplaceShaderValues(std::string& vertexShader, std::string& geometryShader,
140  std::string& fragmentShader, vtkAbstractMapper* mapper, vtkProp* prop) override;
145  bool SetShaderParameters(vtkShaderProgram* program, vtkAbstractMapper* mapper, vtkProp* prop,
146  vtkOpenGLVertexArrayObject* VAO = nullptr) override;
156 
161  void BeginPass(vtkRenderer* ren);
162 
166  void EndPass();
167 
172  void RenderOpaqueGeometry(const vtkRenderState* s);
173 
177  void RenderPieceFinish();
178 
182  void RenderPieceStart(vtkDataArray* dataArr, vtkMapper* m);
183 
188  void BeginMapperRender(vtkMapper* mapper, vtkDataArray* dataArray, vtkProperty* property);
189 
193  void EndMapperRender(vtkMapper* mapper, vtkProperty* property);
194 
195  void InitializeBuffers(vtkRenderer* ren);
196 
200  bool UpdateShaders(std::string& VSSource, std::string& FSSource);
201 
205  void BindAttributes(vtkShaderProgram* prog, vtkOpenGLVertexArrayObject* VAO);
206  void BindUniforms(vtkShaderProgram* prog);
207 
209 
212  bool HasWindowSizeChanged(vtkRenderer* ren);
213  bool InitializeFBO(vtkRenderer* ren);
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
vtkOpenGLRenderPass::GetShaderStageMTime
virtual vtkMTimeType GetShaderStageMTime()
For multi-stage render passes that need to change shader code during a single pass,...
vtkX3D::component
@ component
Definition: vtkX3D.h:181
vtkRenderPass::ReleaseGraphicsResources
virtual void ReleaseGraphicsResources(vtkWindow *w)
Release graphics resources and ask components to release their own resources.
vtkX3D::scale
@ scale
Definition: vtkX3D.h:235
vtkX3D::value
@ value
Definition: vtkX3D.h:226
vtkOpenGLRenderPass::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkFloatArray
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:35
vtkX3D::data
@ data
Definition: vtkX3D.h:321
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkRenderPass::Render
virtual void Render(const vtkRenderState *s)=0
Perform rendering according to a render state s.
vtkSmartPointer< vtkAbstractArray >
vtkValuePass::Mode
Mode
Definition: vtkValuePass.h:64
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:49
max
#define max(a, b)
Definition: vtkX3DExporterFIWriterHelper.h:31
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
vtkX3D::color
@ color
Definition: vtkX3D.h:227
vtkOpenGLRenderPass::SetShaderParameters
virtual bool SetShaderParameters(vtkShaderProgram *program, vtkAbstractMapper *mapper, vtkProp *prop, vtkOpenGLVertexArrayObject *VAO=nullptr)
Update the uniforms of the shader program.
vtkX3D::height
@ height
Definition: vtkX3D.h:260
vtkMapper
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:80
vtkShaderProgram
The ShaderProgram uses one or more Shader objects.
Definition: vtkShaderProgram.h:44
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:45
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkSmartPointer.h
vtkX3D::name
@ name
Definition: vtkX3D.h:225
vtkOpenGLRenderPass::PostReplaceShaderValues
virtual bool PostReplaceShaderValues(std::string &vertexShader, std::string &geometryShader, std::string &fragmentShader, vtkAbstractMapper *mapper, vtkProp *prop)
Use vtkShaderProgram::Substitute to replace //VTK::XXX:YYY declarations in the shader sources.
vtkValuePass::ImplInv
vtkInternalsInvertible * ImplInv
Definition: vtkValuePass.h:220
vtkAbstractArray
Abstract superclass for all arrays.
Definition: vtkAbstractArray.h:75
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:53
vtkValuePass
Definition: vtkValuePass.h:61
vtkX3D::string
@ string
Definition: vtkX3D.h:496
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:67
vtkOpenGLRenderPass
Abstract render pass with shader modifications.
Definition: vtkOpenGLRenderPass.h:38
vtkOpenGLRenderPass.h
vtkValuePass::PassState
Parameters * PassState
Definition: vtkValuePass.h:223
vtkProperty
represent surface properties of a geometric object
Definition: vtkProperty.h:61
vtkRenderWindow
create a window for renderers to draw into
Definition: vtkRenderWindow.h:93
vtkValuePass::RenderingMode
int RenderingMode
Definition: vtkValuePass.h:226
vtkRenderState
Context in which a vtkRenderPass will render.
Definition: vtkRenderState.h:40
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:59
vtkValuePass::ImplFloat
vtkInternalsFloat * ImplFloat
Definition: vtkValuePass.h:217
vtkOpenGLVertexArrayObject
The VertexArrayObject class uses, or emulates, vertex array objects.
Definition: vtkOpenGLVertexArrayObject.h:36
vtkAbstractMapper
abstract class specifies interface to map data
Definition: vtkAbstractMapper.h:52
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:293