VTK  9.3.0
vtkCompositeMapperHelper2.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
3
4#ifndef vtkCompositeMapperHelper2_h
5#define vtkCompositeMapperHelper2_h
6
7#include "vtkColor.h" // class uses vtkColor
8#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_3_0
9#include "vtkRenderingOpenGL2Module.h" // for export macro
10#include "vtk_glew.h" // for OpenGL enums
11// clang-format off
12// Must be included after vtk_glew.h for GL_ES_VERSION_3_0
13#ifndef GL_ES_VERSION_3_0
15#define vtkOpenGLPolyDataMapperImplementation vtkOpenGLPolyDataMapper
16#else
18#define vtkOpenGLPolyDataMapperImplementation vtkOpenGLES30PolyDataMapper
19#endif
20// clang-format on
21
22VTK_ABI_NAMESPACE_BEGIN
23class vtkPolyData;
25
26// this class encapsulates values tied to a
27// polydata
28
30 "Please use vtkCompositePolyDataMapper instead") vtkCompositeMapperHelperData
31{
32public:
34 unsigned int FlatIndex;
35 double Opacity;
44
45 bool Marked;
46
47 unsigned int StartVertex;
48 unsigned int NextVertex;
49
50 // point line poly strip edge stripedge
51 unsigned int StartIndex[vtkOpenGLPolyDataMapper::PrimitiveEnd];
53
54 // stores the mapping from vtk cells to gl_PrimitiveId
56};
57
58//===================================================================
60class VTK_DEPRECATED_IN_9_3_0("Please use vtkCompositePolyDataMapper instead")
61 VTKRENDERINGOPENGL2_EXPORT vtkCompositeMapperHelper2
63{
64public:
67 void PrintSelf(ostream& os, vtkIndent indent) override;
68
69 void SetParent(vtkCompositePolyDataMapper2* p) { this->Parent = p; }
70
71 vtkCompositeMapperHelperData* AddData(vtkPolyData* pd, unsigned int flatIndex);
72
76 void RenderPiece(vtkRenderer* ren, vtkActor* act) override;
77
81 void ClearMark();
83 bool GetMarked() { return this->Marked; }
84 void SetMarked(bool v) { this->Marked = v; }
86
90 std::vector<vtkPolyData*> GetRenderedList() const;
91
97 vtkHardwareSelector* sel, std::vector<unsigned int>& pixeloffsets, vtkProp* prop) override;
98
100 vtkCompositeMapperHelperData* hdata, std::vector<unsigned int>& mypixels);
101
102protected:
104 std::map<vtkPolyData*, vtkCompositeMapperHelperData*> Data;
105
106 bool Marked;
107
109 void UpdateCameraShiftScale(vtkRenderer* ren, vtkActor* actor) override;
110
111 vtkCompositeMapperHelper2() { this->Parent = nullptr; };
113
114 void DrawIBO(vtkRenderer* ren, vtkActor* actor, int primType, vtkOpenGLHelper& CellBO,
115 GLenum mode, int pointSize);
116
117 virtual void SetShaderValues(
118 vtkShaderProgram* prog, vtkCompositeMapperHelperData* hdata, size_t primOffset);
119
124 void UpdateShaders(vtkOpenGLHelper& cellBO, vtkRenderer* ren, vtkActor* act) override;
125
131 std::map<vtkShader::Type, vtkShader*> shaders, vtkRenderer* ren, vtkActor* act) override;
132
137
141 void BuildBufferObjects(vtkRenderer* ren, vtkActor* act) override;
143 vtkCompositeMapperHelperData* hdata, vtkIdType& flat_index, std::vector<unsigned char>& colors,
144 std::vector<float>& norms);
145
150 vtkPolyData* poly, std::vector<unsigned int> (&indices)[4], vtkIdType offset) override;
151
158
159 std::vector<unsigned int> VertexOffsets;
160
161 // vert line poly strip edge stripedge
162 std::vector<unsigned int> IndexArray[PrimitiveEnd];
163
164 void RenderPieceDraw(vtkRenderer* ren, vtkActor* act) override;
165
168
170
172 std::vector<std::vector<unsigned int>> PickPixels;
173
174 std::map<vtkAbstractArray*, vtkDataArray*> ColorArrayMap;
175
176private:
178 void operator=(const vtkCompositeMapperHelper2&) = delete;
179};
180
181VTK_ABI_NAMESPACE_END
182#endif
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:41
Helper class for vtkCompositePolyDataMapper2 that is a subclass of vtkOpenGLPolyDataMapper.
vtkCompositeMapperHelperData * AddData(vtkPolyData *pd, unsigned int flatIndex)
void UpdateShaders(vtkOpenGLHelper &cellBO, vtkRenderer *ren, vtkActor *act) override
Make sure appropriate shaders are defined, compiled and bound.
void ProcessSelectorPixelBuffers(vtkHardwareSelector *sel, std::vector< unsigned int > &pixeloffsets, vtkProp *prop) override
allows a mapper to update a selections color buffers Called from a prop which in turn is called from ...
void RenderPiece(vtkRenderer *ren, vtkActor *act) override
Implemented by sub classes.
void DrawIBO(vtkRenderer *ren, vtkActor *actor, int primType, vtkOpenGLHelper &CellBO, GLenum mode, int pointSize)
std::vector< unsigned int > VertexOffsets
void UpdateCameraShiftScale(vtkRenderer *ren, vtkActor *actor) override
handle updating shift scale based on pose changes
virtual void ProcessCompositePixelBuffers(vtkHardwareSelector *sel, vtkProp *prop, vtkCompositeMapperHelperData *hdata, std::vector< unsigned int > &mypixels)
std::map< vtkAbstractArray *, vtkDataArray * > ColorArrayMap
virtual void SetShaderValues(vtkShaderProgram *prog, vtkCompositeMapperHelperData *hdata, size_t primOffset)
void ReplaceShaderColor(std::map< vtkShader::Type, vtkShader * > shaders, vtkRenderer *ren, vtkActor *act) override
Perform string replacements on the shader templates, called from ReplaceShaderValues.
virtual void AppendOneBufferObject(vtkRenderer *ren, vtkActor *act, vtkCompositeMapperHelperData *hdata, vtkIdType &flat_index, std::vector< unsigned char > &colors, std::vector< float > &norms)
void RenderPieceDraw(vtkRenderer *ren, vtkActor *act) override
std::vector< vtkPolyData * > GetRenderedList() const
Accessor to the ordered list of PolyData that we last drew.
vtkCompositePolyDataMapper2 * Parent
bool GetNeedToRebuildBufferObjects(vtkRenderer *ren, vtkActor *act) override
Does the VBO/IBO need to be rebuilt.
static vtkCompositeMapperHelper2 * New()
void BuildBufferObjects(vtkRenderer *ren, vtkActor *act) override
Build the VBO/IBO, called by UpdateBufferObjects.
void SetParent(vtkCompositePolyDataMapper2 *p)
std::map< vtkPolyData *, vtkCompositeMapperHelperData * > Data
int CanUseTextureMapForColoring(vtkDataObject *) override
Returns if we can use texture maps for scalar coloring.
void BuildSelectionIBO(vtkPolyData *poly, std::vector< unsigned int >(&indices)[4], vtkIdType offset) override
Build the selection IBOs, called by UpdateBufferObjects.
void PrintSelf(ostream &os, vtkIndent indent) override
std::vector< std::vector< unsigned int > > PickPixels
used by the hardware selector
~vtkCompositeMapperHelper2() override
vtkNew< vtkOpenGLCellToVTKCellMap > CellCellMap
mapper for composite dataset consisting of polygonal data.
general representation of visualization data
a simple class to control print indentation
Definition vtkIndent.h:29
Allocate and hold a VTK object.
Definition vtkNew.h:51
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:80
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:43
abstract specification for renderers
Definition vtkRenderer.h:59
The ShaderProgram uses one or more Shader objects.
#define vtkOpenGLPolyDataMapperImplementation
#define VTK_DEPRECATED_IN_9_3_0(reason)
int vtkIdType
Definition vtkType.h:315