VTK  9.3.1
vtkOpenGLCompositePolyDataMapperDelegator.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 
14 #ifndef vtkOpenGLCompositePolyDataMapperDelegator_h
15 #define vtkOpenGLCompositePolyDataMapperDelegator_h
16 
18 
19 #include "vtkNew.h" // for ivar
20 #include "vtkOpenGLPolyDataMapper.h" // for PrimitiveEnd
21 #include "vtkRenderingOpenGL2Module.h" // for export macro
22 
23 VTK_ABI_NAMESPACE_BEGIN
25 
26 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLCompositePolyDataMapperDelegator
28 {
29 public:
32  void PrintSelf(ostream& os, vtkIndent indent) override;
33 
34  // This class extends the rendering attributes for a vtkPolyData with OpenGL specifics.
37  {
39 
40  unsigned int StartVertex;
41  unsigned int NextVertex;
42 
43  // point line poly strip edge stripedge
44  unsigned int StartIndex[vtkOpenGLPolyDataMapper::PrimitiveEnd];
45  unsigned int NextIndex[vtkOpenGLPolyDataMapper::PrimitiveEnd];
46 
47  // stores the mapping from vtk cells to gl_PrimitiveId
49  };
50 
52 
55  // Copy array names used for selection. Ex: PointIdArrayName, CompositeIdArrayName, ..
56  void ShallowCopy(vtkCompositePolyDataMapper* mapper) override;
57  void ClearUnmarkedBatchElements() override;
58  void UnmarkBatchElements() override;
60 
61 protected:
64 
66 
69  std::vector<vtkPolyData*> GetRenderedList() const override;
70  void SetParent(vtkCompositePolyDataMapper* mapper) override;
71  void Insert(BatchElement&& item) override;
72  BatchElement* Get(vtkPolyData* polydata) override;
73  void Clear() override;
75 
76  // The actual mapper which renders multiple vtkPolyData.
77  // Constructor assigns it to vtkBatchedPolyDataMapperDelegator::Delegate.
78  // From that point on, parent class manages lifetime of this GLDelegate.
79  // Instead of repeatedly downcasting the abstract Delegate, we trampoline
80  // calls to GLDelegate.
81  vtkOpenGLBatchedPolyDataMapper* GLDelegate = nullptr;
82 
83 private:
86  void operator=(const vtkOpenGLCompositePolyDataMapperDelegator&) = delete;
87 };
88 
89 VTK_ABI_NAMESPACE_END
90 #endif
virtual void UnmarkBatchElements()=0
Keep track of what data is being used as the structure can change.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void ClearUnmarkedBatchElements()=0
Keep track of what data is being used as the structure can change.
virtual void ShallowCopy(vtkCompositePolyDataMapper *polydataMapper)
Shallow copies scalar array related properties into the delegate.
An OpenGL mapper for batched rendering of vtkPolyData.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
Delegates rendering of multiple polydata that share similar signatures.
virtual std::vector< vtkPolyData * > GetRenderedList() const =0
Accessor to the ordered list of PolyData that we last drew.
a simple class to control print indentation
Definition: vtkIndent.h:28
static vtkCompositePolyDataMapperDelegator * New()
virtual void SetParent(vtkCompositePolyDataMapper *mapper)=0
Assign a parent mapper.
An OpenGL delegator for batched rendering of multipler polydata with similar structure.
virtual BatchElement * Get(vtkPolyData *polydata)=0
Get the batch element that describes attributes for a vtkPolyData.
virtual void Clear()=0
Clear all batch elements.
virtual void Insert(BatchElement &&element)=0
Add input polydata and it's rendering attributes to internal storage.
a class that renders hierarchical polygonal data