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 Visibility;
14 
15  bool Marked;
16 
17  unsigned int StartVertex;
18  unsigned int NextVertex;
19 
20  // point line poly strip edge stripedge
23 
24  // Point Line Poly Strip end
25  size_t PrimOffsets[5];
26 };
27 
28 //===================================================================
29 // We define a helper class that is a subclass of vtkOpenGLPolyDataMapper
30 class VTKRENDERINGOPENGL2_EXPORT vtkCompositeMapperHelper2 : public vtkOpenGLPolyDataMapper
31 {
32 public:
33  static vtkCompositeMapperHelper2* New();
35 
37  this->Parent = p; }
38 
39  vtkCompositeMapperHelperData *AddData(vtkPolyData *pd, unsigned int flatIndex);
40 
41  // Description:
42  // Implemented by sub classes. Actual rendering is done here.
43  void RenderPiece(vtkRenderer *ren, vtkActor *act) override;
44 
45  // keep track of what data is being used as the multiblock
46  // can change
47  void ClearMark();
48  void RemoveUnused();
49  bool GetMarked() { return this->Marked; }
50  void SetMarked(bool v) { this->Marked = v; }
51 
55  std::vector<vtkPolyData*> GetRenderedList(){ return this->RenderedList; }
56 
61  void ProcessSelectorPixelBuffers(vtkHardwareSelector *sel,
62  std::vector<unsigned int> &pixeloffsets,
63  vtkProp *prop) override;
64 
65  virtual void ProcessCompositePixelBuffers(vtkHardwareSelector *sel,
67  std::vector<unsigned int> &mypixels);
68 
69 protected:
71  std::map<vtkPolyData *, vtkCompositeMapperHelperData *> Data;
72 
73  bool Marked;
74 
76  {
77  this->Parent = nullptr;
78  };
79  ~vtkCompositeMapperHelper2() override;
80 
81  void DrawIBO(
82  vtkRenderer* ren, vtkActor *actor,
83  int primType,
84  vtkOpenGLHelper &CellBO,
85  GLenum mode,
86  int pointSize);
87 
88  virtual void SetShaderValues(
89  vtkShaderProgram *prog,
91  size_t primOffset);
92 
97  virtual void UpdateShaders(
98  vtkOpenGLHelper &cellBO, vtkRenderer *ren, vtkActor *act) override;
99 
100  // Description:
101  // Perform string replacements on the shader templates, called from
102  // ReplaceShaderValues
103  void ReplaceShaderColor(
104  std::map<vtkShader::Type, vtkShader *> shaders,
105  vtkRenderer *ren, vtkActor *act) override;
106 
107  // Description:
108  // Build the VBO/IBO, called by UpdateBufferObjects
109  void BuildBufferObjects(vtkRenderer *ren, vtkActor *act) override;
110  virtual void AppendOneBufferObject(vtkRenderer *ren,
112  vtkIdType &flat_index,
113  std::vector<unsigned char> &colors,
114  std::vector<float> &norms);
115 
116  // Description:
117  // Returns if we can use texture maps for scalar coloring. Note this doesn't
118  // say we "will" use scalar coloring. It says, if we do use scalar coloring,
119  // we will use a texture. Always off for this mapper.
120  int CanUseTextureMapForColoring(vtkDataObject*) override;
121 
122  std::vector<unsigned int> VertexOffsets;
123 
124  // vert line poly strip edge stripedge
125  std::vector<unsigned int> IndexArray[PrimitiveEnd];
126 
127  void RenderPieceDraw(vtkRenderer *ren, vtkActor *act) override;
128 
131 
133 
134  std::vector<vtkPolyData*> RenderedList;
135 
136  // used by the hardware selector
137  std::vector<std::vector<unsigned int>> PickPixels;
138 
139  std::map<vtkAbstractArray*, vtkDataArray*> ColorArrayMap;
140 
141 private:
143  void operator=(const vtkCompositeMapperHelper2&) = delete;
144 };
145 // VTK-HeaderTest-Exclude: vtkCompositePolyDataMapper2Internal.h
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:52
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:63
std::map< vtkPolyData *, vtkCompositeMapperHelperData * > Data
int vtkIdType
Definition: vtkType.h:347
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
std::vector< vtkPolyData * > GetRenderedList()
Accessor to the ordered list of PolyData that we last drew.
std::vector< std::vector< unsigned int > > PickPixels
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]