VTK  9.7.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 #include "vtk_glad.h"
24 
25 VTK_ABI_NAMESPACE_BEGIN
26 #ifdef GL_ES_VERSION_3_0
28 #define GLDelegateClass vtkOpenGLLowMemoryBatchedPolyDataMapper
29 #else
31 #define GLDelegateClass vtkOpenGLBatchedPolyDataMapper
32 #endif
34 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLCompositePolyDataMapperDelegator
36 {
37 public:
40  static vtkOverrideAttribute* CreateOverrideAttributes();
42  void PrintSelf(ostream& os, vtkIndent indent) override;
43 
44  // This class extends the rendering attributes for a vtkPolyData with OpenGL specifics.
47  {
49 
50  unsigned int StartVertex;
51  unsigned int NextVertex;
52 
53  // point line poly strip edge stripedge
54  unsigned int StartIndex[vtkOpenGLPolyDataMapper::PrimitiveEnd];
55  unsigned int NextIndex[vtkOpenGLPolyDataMapper::PrimitiveEnd];
56 
57  // stores the mapping from vtk cells to gl_PrimitiveId
59  };
60 
62 
65  // Copy array names used for selection. Ex: PointIdArrayName, CompositeIdArrayName, ..
66  void ShallowCopy(vtkCompositePolyDataMapper* mapper) override;
67  void ClearUnmarkedBatchElements() override;
68  void UnmarkBatchElements() override;
70 
71 protected:
74 
76 
79  std::vector<vtkPolyData*> GetRenderedList() const override;
80  void SetParent(vtkCompositePolyDataMapper* mapper) override;
81  void Insert(BatchElement&& item) override;
82  BatchElement* Get(vtkPolyData* polydata) override;
83  void Clear() override;
85 
86  // The actual mapper which renders multiple vtkPolyData.
87  // Constructor assigns it to vtkBatchedPolyDataMapperDelegator::Delegate.
88  // From that point on, parent class manages lifetime of this GLDelegate.
89  // Instead of repeatedly downcasting the abstract Delegate, we trampoline
90  // calls to GLDelegate.
91  GLDelegateClass* GLDelegate = nullptr;
92 
93 private:
96  void operator=(const vtkOpenGLCompositePolyDataMapperDelegator&) = delete;
97 };
98 
99 #define vtkOpenGLCompositePolyDataMapperDelegator_OVERRIDE_ATTRIBUTES \
100  vtkOpenGLCompositePolyDataMapperDelegator::CreateOverrideAttributes()
101 VTK_ABI_NAMESPACE_END
102 #endif
Attribute for vtkObjectFactory overrides.
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:71
An OpenGL mapper for batched rendering of vtkPolyData.
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.
#define VTK_NEWINSTANCE
An OpenGL delegator for batched rendering of multiple 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