VTK
vtkCompositePolyDataMapper2Internal.h
Go to the documentation of this file.
1 // this class encapsulates values tied to a
2 // polydata
4 {
5 public:
7  unsigned int FlatIndex;
8  double Opacity;
9  bool IsOpaque;
10  bool Visibility;
15 
16  bool Marked;
17 
18  unsigned int StartVertex;
19  unsigned int NextVertex;
20 
21  // point line poly strip edge stripedge
24 
25  // stores the mapping from vtk cells to gl_PrimitiveId
27 };
28 
29 //===================================================================
30 // We define a helper class that is a subclass of vtkOpenGLPolyDataMapper
31 class VTKRENDERINGOPENGL2_EXPORT vtkCompositeMapperHelper2 : public vtkOpenGLPolyDataMapper
32 {
33 public:
34  static vtkCompositeMapperHelper2* New();
36 
38  this->Parent = p; }
39 
40  vtkCompositeMapperHelperData *AddData(vtkPolyData *pd, unsigned int flatIndex);
41 
42  // Description:
43  // Implemented by sub classes. Actual rendering is done here.
44  void RenderPiece(vtkRenderer *ren, vtkActor *act) override;
45 
46  // keep track of what data is being used as the multiblock
47  // can change
48  void ClearMark();
49  void RemoveUnused();
50  bool GetMarked() { return this->Marked; }
51  void SetMarked(bool v) { this->Marked = v; }
52 
56  std::vector<vtkPolyData*> GetRenderedList(){ return this->RenderedList; }
57 
62  void ProcessSelectorPixelBuffers(vtkHardwareSelector *sel,
63  std::vector<unsigned int> &pixeloffsets,
64  vtkProp *prop) override;
65 
66  virtual void ProcessCompositePixelBuffers(vtkHardwareSelector *sel,
68  std::vector<unsigned int> &mypixels);
69 
70 protected:
72  std::map<vtkPolyData *, vtkCompositeMapperHelperData *> Data;
73 
74  bool Marked;
75 
77  {
78  this->Parent = nullptr;
79  };
80  ~vtkCompositeMapperHelper2() override;
81 
82  void DrawIBO(
83  vtkRenderer* ren, vtkActor *actor,
84  int primType,
85  vtkOpenGLHelper &CellBO,
86  GLenum mode,
87  int pointSize);
88 
89  virtual void SetShaderValues(
90  vtkShaderProgram *prog,
92  size_t primOffset);
93 
98  virtual void UpdateShaders(
99  vtkOpenGLHelper &cellBO, vtkRenderer *ren, vtkActor *act) override;
100 
101  // Description:
102  // Perform string replacements on the shader templates, called from
103  // ReplaceShaderValues
104  void ReplaceShaderColor(
105  std::map<vtkShader::Type, vtkShader *> shaders,
106  vtkRenderer *ren, vtkActor *act) override;
107 
108  // Description:
109  // Build the VBO/IBO, called by UpdateBufferObjects
110  void BuildBufferObjects(vtkRenderer *ren, vtkActor *act) override;
111  virtual void AppendOneBufferObject(vtkRenderer *ren,
113  vtkIdType &flat_index,
114  std::vector<unsigned char> &colors,
115  std::vector<float> &norms);
116 
117  // Description:
118  // Returns if we can use texture maps for scalar coloring. Note this doesn't
119  // say we "will" use scalar coloring. It says, if we do use scalar coloring,
120  // we will use a texture. Always off for this mapper.
121  int CanUseTextureMapForColoring(vtkDataObject*) override;
122 
123  std::vector<unsigned int> VertexOffsets;
124 
125  // vert line poly strip edge stripedge
126  std::vector<unsigned int> IndexArray[PrimitiveEnd];
127 
128  void RenderPieceDraw(vtkRenderer *ren, vtkActor *act) override;
129 
132 
134 
135  std::vector<vtkPolyData*> RenderedList;
136 
137  // used by the hardware selector
138  std::vector<std::vector<unsigned int>> PickPixels;
139 
140  std::map<vtkAbstractArray*, vtkDataArray*> ColorArrayMap;
141 
142 private:
144  void operator=(const vtkCompositeMapperHelper2&) = delete;
145 };
146 // VTK-HeaderTest-Exclude: vtkCompositePolyDataMapper2Internal.h
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:50
std::map< vtkAbstractArray *, vtkDataArray * > ColorArrayMap
PolyDataMapper using OpenGL to render.
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
mapper for composite dataset consisting of polygonal data.
abstract specification for renderers
Definition: vtkRenderer.h:64
std::map< vtkPolyData *, vtkCompositeMapperHelperData * > Data
int vtkIdType
Definition: vtkType.h:349
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:84
std::vector< vtkPolyData * > GetRenderedList()
Accessor to the ordered list of PolyData that we last drew.
std::vector< std::vector< unsigned int > > PickPixels
vtkNew< vtkOpenGLCellToVTKCellMap > CellCellMap
general representation of visualization data
Definition: vtkDataObject.h:64
void SetParent(vtkCompositePolyDataMapper2 *p)
unsigned int StartIndex[vtkOpenGLPolyDataMapper::PrimitiveEnd]
The ShaderProgram uses one or more Shader objects.
unsigned int NextIndex[vtkOpenGLPolyDataMapper::PrimitiveEnd]