VTK
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 =========================================================================*/
40 #ifndef vtkValuePass_h
41 #define vtkValuePass_h
42 
43 #include "vtkOpenGLRenderPass.h"
44 #include "vtkRenderingOpenGL2Module.h" // For export macro
45 #include "vtkSmartPointer.h" //for ivar
46 
47 class vtkAbstractArray;
48 class vtkActor;
49 class vtkDataArray;
50 class vtkDataObject;
51 class vtkFloatArray;
52 class vtkMapper;
54 class vtkProperty;
55 class vtkRenderer;
56 class vtkRenderWindow;
57 class vtkShaderProgram;
58 
59 class VTKRENDERINGOPENGL2_EXPORT vtkValuePass : public vtkOpenGLRenderPass
60 {
61 public:
62 
63  enum Mode
64  {
65  INVERTIBLE_LUT = 1,
66  FLOATING_POINT = 2
67  };
68 
69  static vtkValuePass *New();
71  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
72 
73  vtkSetMacro(RenderingMode, int);
74  vtkGetMacro(RenderingMode, int);
75  void SetInputArrayToProcess(int fieldAssociation, const char *name);
76  void SetInputArrayToProcess(int fieldAssociation, int fieldId);
77  void SetInputComponentToProcess(int component);
78  void SetScalarRange(double min, double max);
79 
84  void Render(const vtkRenderState *s) VTK_OVERRIDE;
85 
91  vtkFloatArray* GetFloatImageDataArray(vtkRenderer* ren);
92 
98  void GetFloatImageData(int const format, int const width, int const height,
99  void* data);
100 
105  int* GetFloatImageExtents();
106 
110  bool IsFloatingPointModeSupported();
111 
112  void ReleaseGraphicsResources(vtkWindow *win) VTK_OVERRIDE;
113 
118  void ColorToValue(unsigned char const* color, double const min, double const scale,
119  double& value);
120 
121  protected:
122  vtkValuePass();
123  ~vtkValuePass() VTK_OVERRIDE;
124 
126 
135  bool PostReplaceShaderValues(std::string &vertexShader,
136  std::string &geometryShader,
137  std::string &fragmentShader,
138  vtkAbstractMapper *mapper,
139  vtkProp *prop) VTK_OVERRIDE;
144  bool SetShaderParameters(vtkShaderProgram* program,
145  vtkAbstractMapper* mapper, vtkProp* prop,
146  vtkOpenGLVertexArrayObject* VAO = NULL) VTK_OVERRIDE;
154  vtkMTimeType GetShaderStageMTime() VTK_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,
189  vtkProperty* property);
190 
194  void EndMapperRender(vtkMapper* mapper, vtkProperty* property);
195 
196  void InitializeBuffers(vtkRenderer* ren);
197 
201  bool UpdateShaders(std::string& VSSource, std::string& FSSource);
202 
206  void BindAttributes(vtkShaderProgram* prog, vtkOpenGLVertexArrayObject* VAO);
207  void BindUniforms(vtkShaderProgram* prog);
208 
210 
213  bool HasWindowSizeChanged(vtkRenderer* ren);
214  bool InitializeFBO(vtkRenderer* ren);
215  void ReleaseFBO(vtkWindow* win);
217 
218  class vtkInternalsFloat;
219  vtkInternalsFloat* ImplFloat;
220 
221  class vtkInternalsInvertible;
222  vtkInternalsInvertible* ImplInv;
223 
224  struct Parameters;
225  Parameters* PassState;
226 
227  int RenderingMode;
228 
229  private:
230  vtkDataArray* GetCurrentArray(vtkMapper* mapper, Parameters* arrayPar);
231 
232  vtkAbstractArray* GetArrayFromCompositeData(vtkMapper* mapper,
233  Parameters* arrayPar);
234 
235  vtkSmartPointer<vtkAbstractArray> MultiBlocksArray;
236 
237  void PopulateCellCellMap(const vtkRenderState *s);
238 
239  vtkValuePass(const vtkValuePass&) VTK_DELETE_FUNCTION;
240  void operator=(const vtkValuePass&) VTK_DELETE_FUNCTION;
241 };
242 
243 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:44
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:45
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:300
represent surface properties of a geometric object
Definition: vtkProperty.h:58
Abstract superclass for all arrays.
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:35
abstract specification for renderers
Definition: vtkRenderer.h:57
Hold a reference to a vtkObjectBase instance.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
Context in which a vtkRenderPass will render.
a simple class to control print indentation
Definition: vtkIndent.h:33
The VertexArrayObject class uses, or emulates, vertex array objects.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:48
Render opaque objects with the vtkValuePainter.
Definition: vtkValuePass.h:31
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:85
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
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 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...
Abstract render pass with shader modifications.
general representation of visualization data
Definition: vtkDataObject.h:58
#define max(a, b)
The ShaderProgram uses one or more Shader objects.