VTK
9.6.2
Main Page
Related Pages
Topics
Namespaces
Classes
Files
File List
File Members
Rendering
OpenGL2
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
29
VTK_ABI_NAMESPACE_BEGIN
30
class
vtkCellArray
;
31
class
vtkGenericOpenGLResourceFreeCallback
;
32
class
vtkMatrix4x4
;
33
class
vtkMatrix3x3
;
34
class
vtkOpenGLCellToVTKCellMap
;
35
class
vtkOpenGLRenderTimer
;
36
class
vtkOpenGLTexture
;
37
class
vtkOpenGLBufferObject
;
38
class
vtkOpenGLVertexBufferObject
;
39
class
vtkOpenGLVertexBufferObjectGroup
;
40
class
vtkPoints
;
41
class
vtkTexture
;
42
class
vtkTextureObject
;
43
class
vtkTransform
;
44
class
vtkOpenGLShaderProperty
;
45
46
class
VTKRENDERINGOPENGL2_EXPORT
VTK_MARSHALAUTO
vtkOpenGLPolyDataMapper
:
public
vtkPolyDataMapper
47
{
48
public
:
49
static
vtkOpenGLPolyDataMapper
*
New
();
50
vtkTypeMacro(
vtkOpenGLPolyDataMapper
,
vtkPolyDataMapper
);
51
void
PrintSelf
(ostream& os,
vtkIndent
indent)
override
;
52
56
void
RenderPiece
(
vtkRenderer
* ren,
vtkActor
* act)
override
;
57
63
MapperHashType
GenerateHash
(
vtkPolyData
* polydata)
override
;
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
79
void
ReleaseGraphicsResources
(
vtkWindow
*)
override
;
80
81
VTK_MARSHALEXCLUDE
(
VTK_MARSHAL_EXCLUDE_REASON_IS_INTERNAL
)
82
vtkGetMacro(
PopulateSelectionSettings
,
int
);
83
VTK_MARSHALEXCLUDE
(
VTK_MARSHAL_EXCLUDE_REASON_IS_INTERNAL
)
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)
97
vtkPolyData
*
CurrentInput
;
98
102
void
ShallowCopy
(
vtkAbstractMapper
* m)
override
;
103
105
vtkGetObjectMacro(
VBOs
,
vtkOpenGLVertexBufferObjectGroup
);
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)
125
enum
PrimitiveTypes
126
{
127
PrimitiveStart
= 0,
128
PrimitivePoints
= 0,
129
PrimitiveLines
,
130
PrimitiveTris
,
131
PrimitiveTriStrips
,
132
PrimitiveVertices
,
133
PrimitiveEnd
134
};
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
166
void
RemoveAllVertexAttributeMappings
()
override
;
167
172
void
ProcessSelectorPixelBuffers
(
173
vtkHardwareSelector
* sel, std::vector<unsigned int>& pixeloffsets,
vtkProp
* prop)
override
;
174
175
protected
:
176
vtkOpenGLPolyDataMapper
();
177
~vtkOpenGLPolyDataMapper
()
override
;
178
179
vtkGenericOpenGLResourceFreeCallback
*
ResourceCallback
;
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
211
virtual
bool
GetNeedToRebuildShaders
(
vtkOpenGLHelper
& cellBO,
vtkRenderer
* ren,
vtkActor
* act);
212
216
virtual
void
BuildShaders
(
217
std::map<vtkShader::Type, vtkShader*> shaders,
vtkRenderer
* ren,
vtkActor
* act);