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;
13 
14  bool Marked;
15 
16  unsigned int StartVertex;
17  unsigned int NextVertex;
18 
19  // point line poly strip edge stripedge
22 
23  // Point Line Poly Strip end
24  size_t PrimOffsets[5];
25 
26  bool Different(
28  vtkHardwareSelector *selector,
29  int primType)
30  {
31  return
32  (selector &&
33  selector->GetCurrentPass() ==
35  this->Opacity != next->Opacity ||
36  this->Visibility != next->Visibility ||
37  this->OverridesColor != next->OverridesColor ||
38  this->AmbientColor != next->AmbientColor ||
39  this->DiffuseColor != next->DiffuseColor ||
40  (primType >= 0 && primType <= 3 &&
41  this->PrimOffsets[primType+1] != next->PrimOffsets[primType]);
42  }
43 
44 };
45 
46 //===================================================================
47 // We define a helper class that is a subclass of vtkOpenGLPolyDataMapper
48 class VTKRENDERINGOPENGL2_EXPORT vtkCompositeMapperHelper2 : public vtkOpenGLPolyDataMapper
49 {
50 public:
53 
55  this->Parent = p; }
56 
57  vtkCompositeMapperHelperData *AddData(vtkPolyData *pd, unsigned int flatIndex);
58 
59  // Description:
60  // Implemented by sub classes. Actual rendering is done here.
61  void RenderPiece(vtkRenderer *ren, vtkActor *act) VTK_OVERRIDE;
62 
63  // keep track of what data is being used as the multiblock
64  // can change
65  void ClearMark();
66  void RemoveUnused();
67  bool GetMarked() { return this->Marked; }
68  void SetMarked(bool v) { this->Marked = v; }
69 
73  std::vector<vtkPolyData*> GetRenderedList(){ return this->RenderedList; }
74 
75 protected:
77  std::map<vtkPolyData *, vtkCompositeMapperHelperData *> Data;
78 
79  bool Marked;
80 
82  {
83  this->Parent = 0;
84  };
85  ~vtkCompositeMapperHelper2() VTK_OVERRIDE;
86 
87  void DrawIBO(
88  vtkRenderer* ren, vtkActor *actor,
89  int primType,
90  vtkOpenGLHelper &CellBO,
91  GLenum mode,
92  int pointSize);
93 
94  void SetShaderValues(
95  vtkShaderProgram *prog,
97  size_t primOffset);
98 
99  // Description:
100  // Perform string replacments on the shader templates, called from
101  // ReplaceShaderValues
102  void ReplaceShaderColor(
103  std::map<vtkShader::Type, vtkShader *> shaders,
104  vtkRenderer *ren, vtkActor *act) VTK_OVERRIDE;
105 
106  // Description:
107  // Determine if the buffer objects need to be rebuilt
108  bool GetNeedToRebuildBufferObjects(vtkRenderer *ren, vtkActor *act) VTK_OVERRIDE;
109 
110  // Description:
111  // Build the VBO/IBO, called by UpdateBufferObjects
112  void BuildBufferObjects(vtkRenderer *ren, vtkActor *act) VTK_OVERRIDE;
113  virtual void AppendOneBufferObject(vtkRenderer *ren,
115  unsigned int &flat_index,
116  std::vector<unsigned char> &colors,
117  std::vector<float> &norms);
118 
119  // Description:
120  // Returns if we can use texture maps for scalar coloring. Note this doesn't
121  // say we "will" use scalar coloring. It says, if we do use scalar coloring,
122  // we will use a texture. Always off for this mapper.
123  int CanUseTextureMapForColoring(vtkDataObject*) VTK_OVERRIDE;
124 
125  std::vector<unsigned int> VertexOffsets;
126 
127  // vert line poly strip edge stripedge
128  std::vector<unsigned int> IndexArray[PrimitiveEnd];
129 
130  void RenderPieceDraw(vtkRenderer *ren, vtkActor *act) VTK_OVERRIDE;
131 
132  bool PrimIDUsed;
133  bool OverideColorUsed;
134 
135  vtkHardwareSelector *CurrentSelector;
136  double CurrentAmbientIntensity;
137  double CurrentDiffuseIntensity;
138 
139  std::vector<vtkPolyData*> RenderedList;
140 
141 private:
142  vtkCompositeMapperHelper2(const vtkCompositeMapperHelper2&) VTK_DELETE_FUNCTION;
143  void operator=(const vtkCompositeMapperHelper2&) VTK_DELETE_FUNCTION;
144 };
145 // VTK-HeaderTest-Exclude: vtkCompositePolyDataMapper2Internal.h
a PolyDataMapper for the OpenGL library
represents an object (geometry &amp; properties) in a rendered scene
Definition: vtkActor.h:45
static vtkOpenGLPolyDataMapper * New()
mapper for composite dataset consisting of polygonal data.
abstract specification for renderers
Definition: vtkRenderer.h:57
std::map< vtkPolyData *, vtkCompositeMapperHelperData * > Data
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
std::vector< vtkPolyData * > GetRenderedList()
Accessor to the ordered list of PolyData that we last drew.
virtual int GetCurrentPass()
Get the current pass number.
void RenderPiece(vtkRenderer *ren, vtkActor *a) override
Implement superclass render method.
Vertex or Fragment shader, combined into a ShaderProgram.
Definition: vtkShader.h:37
manager for OpenGL-based selection.
general representation of visualization data
Definition: vtkDataObject.h:58
bool Different(vtkCompositeMapperHelperData *next, vtkHardwareSelector *selector, int primType)
void SetParent(vtkCompositePolyDataMapper2 *p)
unsigned int StartIndex[vtkOpenGLPolyDataMapper::PrimitiveEnd]
The ShaderProgram uses one or more Shader objects.
unsigned int NextIndex[vtkOpenGLPolyDataMapper::PrimitiveEnd]