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 =========================================================================*/
43 #ifndef vtkValuePass_h
44 #define vtkValuePass_h
45 
46 #include "vtkOpenGLRenderPass.h"
47 #include "vtkRenderingOpenGL2Module.h" // For export macro
48 #include "vtkSmartPointer.h" //for ivar
49 
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 
66  enum Mode
67  {
68  INVERTIBLE_LUT = 1,
69  FLOATING_POINT = 2
70  };
71 
72  static vtkValuePass *New();
74  void PrintSelf(ostream& os, vtkIndent indent) override;
75 
76  vtkSetMacro(RenderingMode, int);
77  vtkGetMacro(RenderingMode, int);
78  void SetInputArrayToProcess(int fieldAssociation, const char *name);
79  void SetInputArrayToProcess(int fieldAssociation, int fieldId);
81  void SetScalarRange(double min, double max);
82 
87  void Render(const vtkRenderState *s) override;
88 
95 
101  void GetFloatImageData(int const format, int const width, int const height,
102  void* data);
103 
109 
114 
115  void ReleaseGraphicsResources(vtkWindow *win) override;
116 
121  void ColorToValue(unsigned char const* color, double const min, double const scale,
122  double& value);
123 
124  protected:
126  ~vtkValuePass() override;
127 
129 
139  std::string &geometryShader,
140  std::string &fragmentShader,
141  vtkAbstractMapper *mapper,
142  vtkProp *prop) override;
148  vtkAbstractMapper* mapper, vtkProp* prop,
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,
192  vtkProperty* property);
193 
197  void EndMapperRender(vtkMapper* mapper, vtkProperty* property);
198 
200 
204  bool UpdateShaders(std::string& VSSource, std::string& FSSource);
205 
211 
213 
218  void ReleaseFBO(vtkWindow* win);
220 
221  class vtkInternalsFloat;
222  vtkInternalsFloat* ImplFloat;
223 
224  class vtkInternalsInvertible;
225  vtkInternalsInvertible* ImplInv;
226 
227  struct Parameters;
228  Parameters* PassState;
229 
231 
232  private:
233  vtkDataArray* GetCurrentArray(vtkMapper* mapper, Parameters* arrayPar);
234 
235  vtkAbstractArray* GetArrayFromCompositeData(vtkMapper* mapper,
236  Parameters* arrayPar);
237 
238  vtkSmartPointer<vtkAbstractArray> MultiBlocksArray;
239 
240  void PopulateCellCellMap(const vtkRenderState *s);
241 
242  vtkValuePass(const vtkValuePass&) = delete;
243  void operator=(const vtkValuePass&) = delete;
244 };
245 
246 #endif
vtkValuePass::ReleaseFBO
void ReleaseFBO(vtkWindow *win)
vtkX3D::component
@ component
Definition: vtkX3D.h:175
vtkX3D::scale
@ scale
Definition: vtkX3D.h:229
vtkValuePass::InitializeFBO
bool InitializeFBO(vtkRenderer *ren)
vtkValuePass::ColorToValue
void ColorToValue(unsigned char const *color, double const min, double const scale, double &value)
Convert an RGB triplet to a floating point value.
vtkX3D::value
@ value
Definition: vtkX3D.h:220
vtkValuePass::GetFloatImageDataArray
vtkFloatArray * GetFloatImageDataArray(vtkRenderer *ren)
Interface to get the rendered image in FLOATING_POINT mode.
vtkValuePass::UpdateShaders
bool UpdateShaders(std::string &VSSource, std::string &FSSource)
Add necessary shader definitions.
vtkFloatArray
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:42
vtkX3D::data
@ data
Definition: vtkX3D.h:315
vtkSmartPointer< vtkAbstractArray >
vtkValuePass::GetFloatImageExtents
int * GetFloatImageExtents()
Interface to get the rendered image in FLOATING_POINT mode.
vtkValuePass::Mode
Mode
Definition: vtkValuePass.h:67
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
vtkValuePass::EndMapperRender
void EndMapperRender(vtkMapper *mapper, vtkProperty *property)
Revert any changes made in BeginMapperRender.
max
#define max(a, b)
Definition: vtkX3DExporterFIWriterHelper.h:31
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:38
vtkValuePass::InitializeBuffers
void InitializeBuffers(vtkRenderer *ren)
vtkValuePass::HasWindowSizeChanged
bool HasWindowSizeChanged(vtkRenderer *ren)
Methods managing graphics resources required during FLOATING_POINT mode.
vtkX3D::color
@ color
Definition: vtkX3D.h:221
vtkValuePass::GetShaderStageMTime
vtkMTimeType GetShaderStageMTime() override
For multi-stage render passes that need to change shader code during a single pass,...
vtkValuePass::BindAttributes
void BindAttributes(vtkShaderProgram *prog, vtkOpenGLVertexArrayObject *VAO)
Bind shader variables.
vtkX3D::height
@ height
Definition: vtkX3D.h:254
vtkValuePass::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkValuePass::vtkValuePass
vtkValuePass()
vtkMapper
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:87
vtkShaderProgram
The ShaderProgram uses one or more Shader objects.
Definition: vtkShaderProgram.h:48
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:52
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkValuePass::EndPass
void EndPass()
Unbinds internal FBO when FLOATING_POINT mode is enabled.
vtkValuePass::GetFloatImageData
void GetFloatImageData(int const format, int const width, int const height, void *data)
Interface to get the rendered image in FLOATING_POINT mode.
vtkValuePass::IsFloatingPointModeSupported
bool IsFloatingPointModeSupported()
Check for extension support.
vtkValuePass::SetScalarRange
void SetScalarRange(double min, double max)
vtkSmartPointer.h
vtkValuePass::RenderOpaqueGeometry
void RenderOpaqueGeometry(const vtkRenderState *s)
Opaque pass with key checking.
vtkValuePass::RenderPieceFinish
void RenderPieceFinish()
Unbind textures, etc.
vtkX3D::name
@ name
Definition: vtkX3D.h:219
vtkValuePass::ImplInv
vtkInternalsInvertible * ImplInv
Definition: vtkValuePass.h:224
vtkAbstractArray
Abstract superclass for all arrays.
Definition: vtkAbstractArray.h:79
vtkValuePass::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *win) override
Release graphics resources and ask components to release their own resources.
vtkValuePass::RenderPieceStart
void RenderPieceStart(vtkDataArray *dataArr, vtkMapper *m)
Upload new data if necessary, bind textures, etc.
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:53
vtkValuePass::BeginPass
void BeginPass(vtkRenderer *ren)
Manages graphics resources depending on the rendering mode.
vtkValuePass
Definition: vtkValuePass.h:63
vtkX3D::string
@ string
Definition: vtkX3D.h:490
vtkValuePass::SetInputArrayToProcess
void SetInputArrayToProcess(int fieldAssociation, int fieldId)
vtkValuePass::Render
void Render(const vtkRenderState *s) override
Perform rendering according to a render state s.
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:64
vtkValuePass::PostReplaceShaderValues
bool PostReplaceShaderValues(std::string &vertexShader, std::string &geometryShader, std::string &fragmentShader, vtkAbstractMapper *mapper, vtkProp *prop) override
vtkOpenGLRenderPass API.
vtkOpenGLRenderPass
Abstract render pass with shader modifications.
Definition: vtkOpenGLRenderPass.h:39
vtkValuePass::SetInputComponentToProcess
void SetInputComponentToProcess(int component)
vtkValuePass::BindUniforms
void BindUniforms(vtkShaderProgram *prog)
vtkValuePass::BeginMapperRender
void BeginMapperRender(vtkMapper *mapper, vtkDataArray *dataArray, vtkProperty *property)
Setup the mapper state, buffer objects or property variables necessary to render the active rendering...
vtkOpenGLRenderPass.h
vtkValuePass::PassState
Parameters * PassState
Definition: vtkValuePass.h:227
vtkValuePass::SetInputArrayToProcess
void SetInputArrayToProcess(int fieldAssociation, const char *name)
vtkProperty
represent surface properties of a geometric object
Definition: vtkProperty.h:67
vtkRenderWindow
create a window for renderers to draw into
Definition: vtkRenderWindow.h:88
vtkValuePass::RenderingMode
int RenderingMode
Definition: vtkValuePass.h:230
vtkRenderState
Context in which a vtkRenderPass will render.
Definition: vtkRenderState.h:41
vtkValuePass::SetShaderParameters
bool SetShaderParameters(vtkShaderProgram *program, vtkAbstractMapper *mapper, vtkProp *prop, vtkOpenGLVertexArrayObject *VAO=nullptr) override
Update the uniforms of the shader program.
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:65
vtkValuePass::ImplFloat
vtkInternalsFloat * ImplFloat
Definition: vtkValuePass.h:221
vtkValuePass::New
static vtkValuePass * New()
vtkOpenGLVertexArrayObject
The VertexArrayObject class uses, or emulates, vertex array objects.
Definition: vtkOpenGLVertexArrayObject.h:37
vtkAbstractMapper
abstract class specifies interface to map data
Definition: vtkAbstractMapper.h:56
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:302
vtkValuePass::~vtkValuePass
~vtkValuePass() override