VTK  9.1.0
vtkCompositeMapperHelper2.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4
5 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
6 All rights reserved.
7 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
8
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the above copyright notice for more information.
12
13=========================================================================*/
14
15#ifndef vtkCompositeMapperHelper2_h
16#define vtkCompositeMapperHelper2_h
17
18#ifndef __VTK_WRAP__
19
21#include "vtkRenderingOpenGL2Module.h" // for export macro
22
23class vtkPolyData;
25
26// this class encapsulates values tied to a
27// polydata
29{
30public:
32 unsigned int FlatIndex;
33 double Opacity;
42
43 bool Marked;
44
45 unsigned int StartVertex;
46 unsigned int NextVertex;
47
48 // point line poly strip edge stripedge
51
52 // stores the mapping from vtk cells to gl_PrimitiveId
54};
55
56//===================================================================
58class VTKRENDERINGOPENGL2_EXPORT vtkCompositeMapperHelper2 : public vtkOpenGLPolyDataMapper
59{
60public:
63 void PrintSelf(ostream& os, vtkIndent indent) override;
64
65 void SetParent(vtkCompositePolyDataMapper2* p) { this->Parent = p; }
66
67 vtkCompositeMapperHelperData* AddData(vtkPolyData* pd, unsigned int flatIndex);
68
72 void RenderPiece(vtkRenderer* ren, vtkActor* act) override;
73
77 void ClearMark();
79 bool GetMarked() { return this->Marked; }
80 void SetMarked(bool v) { this->Marked = v; }
82
86 std::vector<vtkPolyData*> GetRenderedList() const;
87
93 vtkHardwareSelector* sel, std::vector<unsigned int>& pixeloffsets, vtkProp* prop) override;
94
96 vtkCompositeMapperHelperData* hdata, std::vector<unsigned int>& mypixels);
97
98protected:
100 std::map<vtkPolyData*, vtkCompositeMapperHelperData*> Data;
101
102 bool Marked;
103
105 void UpdateCameraShiftScale(vtkRenderer* ren, vtkActor* actor) override;
106
107 vtkCompositeMapperHelper2() { this->Parent = nullptr; };
109
110 void DrawIBO(vtkRenderer* ren, vtkActor* actor, int primType, vtkOpenGLHelper& CellBO,
111 GLenum mode, int pointSize);
112
113 virtual void SetShaderValues(
114 vtkShaderProgram* prog, vtkCompositeMapperHelperData* hdata, size_t primOffset);
115
120 void UpdateShaders(vtkOpenGLHelper& cellBO, vtkRenderer* ren, vtkActor* act) override;
121
127 std::map<vtkShader::Type, vtkShader*> shaders, vtkRenderer* ren, vtkActor* act) override;
128
133
137 void BuildBufferObjects(vtkRenderer* ren, vtkActor* act) override;
139 vtkCompositeMapperHelperData* hdata, vtkIdType& flat_index, std::vector<unsigned char>& colors,
140 std::vector<float>& norms);
141
146 vtkPolyData* poly, std::vector<unsigned int> (&indices)[4], vtkIdType offset) override;
147
154
155 std::vector<unsigned int> VertexOffsets;
156
157 // vert line poly strip edge stripedge
158 std::vector<unsigned int> IndexArray[PrimitiveEnd];
159
160 void RenderPieceDraw(vtkRenderer* ren, vtkActor* act) override;
161
164
166
168 std::vector<std::vector<unsigned int>> PickPixels;
169
170 std::map<vtkAbstractArray*, vtkDataArray*> ColorArrayMap;
171
172private:
174 void operator=(const vtkCompositeMapperHelper2&) = delete;
175};
176
177#endif
178
179#endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:155
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
Implemented by sub classes.
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.
vtkHardwareSelector * CurrentSelector
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
Methods invoked by print to print information about the object including superclasses.
std::vector< std::vector< unsigned int > > PickPixels
used by the hardware selector
~vtkCompositeMapperHelper2() override
unsigned int StartIndex[vtkOpenGLPolyDataMapper::PrimitiveEnd]
unsigned int NextIndex[vtkOpenGLPolyDataMapper::PrimitiveEnd]
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:113
PolyDataMapper using OpenGL to render.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:195
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:67
abstract specification for renderers
Definition: vtkRenderer.h:173
The ShaderProgram uses one or more Shader objects.
@ mode
Definition: vtkX3D.h:253
@ offset
Definition: vtkX3D.h:444
int vtkIdType
Definition: vtkType.h:332