VTK  9.6.2
vtkOpenGLPolyDataMapper.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
12
13#ifndef vtkOpenGLPolyDataMapper_h
14#define vtkOpenGLPolyDataMapper_h
15
16#include "vtkInformation.h" // for prim struct
17#include "vtkNew.h" // For vtkNew
18#include "vtkOpenGLHelper.h" // used for ivars
19#include "vtkPolyDataMapper.h"
20#include "vtkRenderingOpenGL2Module.h" // For export macro
21#include "vtkShader.h" // for methods
22#include "vtkStateStorage.h" // used for ivars
23#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
24
25#include <map> // for map
26#include <tuple> // for tuple
27#include <vector> // for vector
28
29VTK_ABI_NAMESPACE_BEGIN
30class vtkCellArray;
32class vtkMatrix4x4;
33class vtkMatrix3x3;
40class vtkPoints;
41class vtkTexture;
43class vtkTransform;
45
46class VTKRENDERINGOPENGL2_EXPORT VTK_MARSHALAUTO vtkOpenGLPolyDataMapper : public vtkPolyDataMapper
47{
48public:
51 void PrintSelf(ostream& os, vtkIndent indent) override;
52
56 void RenderPiece(vtkRenderer* ren, vtkActor* act) override;
57
64
66
69 virtual void RenderPieceStart(vtkRenderer* ren, vtkActor* act);
70 virtual void RenderPieceDraw(vtkRenderer* ren, vtkActor* act);
71 virtual void RenderPieceFinish(vtkRenderer* ren, vtkActor* act);
73
80
82 vtkGetMacro(PopulateSelectionSettings, int);
84 void SetPopulateSelectionSettings(int v) { this->PopulateSelectionSettings = v; }
85
92 bool GetSupportsSelection() override { return true; }
93
94 // used by RenderPiece and functions it calls to reduce
95 // calls to get the input and allow for rendering of
96 // other polydata (not the input)
98
103
106
110 void SetVBOShiftScaleMethod(int method) override;
111
120 vtkGetMacro(UseProgramPointSize, bool);
121 vtkSetMacro(UseProgramPointSize, bool);
122 vtkBooleanMacro(UseProgramPointSize, bool);
123
124 // NOLINTNEXTLINE(readability-enum-initial-value)
135
147 void MapDataArrayToVertexAttribute(const char* vertexAttributeName, const char* dataArrayName,
148 int fieldAssociation, int componentno = -1) override;
149
150 // This method will Map the specified data array for use as
151 // a texture coordinate for texture tname. The actual
152 // attribute will be named tname_coord so as to not
153 // conflict with the texture sampler definition which will
154 // be tname.
155 void MapDataArrayToMultiTextureAttribute(const char* tname, const char* dataArrayName,
156 int fieldAssociation, int componentno = -1) override;
157
161 void RemoveVertexAttributeMapping(const char* vertexAttributeName) override;
162
167
173 vtkHardwareSelector* sel, std::vector<unsigned int>& pixeloffsets, vtkProp* prop) override;
174
175protected:
178
180
181 void MapDataArray(const char* vertexAttributeName, const char* dataArrayName,
182 const char* texturename, int fieldAssociation, int componentno);
183
184 // what coordinate should be used for this texture
185 std::string GetTextureCoordinateName(const char* tname);
186
187 // handle updating shift scale based on pose changes
188 virtual void UpdateCameraShiftScale(vtkRenderer* ren, vtkActor* actor);
189
193 void GetCoincidentParameters(vtkRenderer* ren, vtkActor* actor, float& factor, float& offset);
194
200 void ComputeBounds() override;
201
206 virtual void UpdateShaders(vtkOpenGLHelper& cellBO, vtkRenderer* ren, vtkActor* act);
207
212
216 virtual void BuildShaders(
217 std::map<vtkShader::Type, vtkShader*> shaders, vtkRenderer* ren, vtkActor* act);