ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
cvHardwareSelector.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
20 #ifndef cvHardwareSelector_h
21 #define cvHardwareSelector_h
22 
23 #include <vtkOpenGLHardwareSelector.h>
24 #include <vtkTimeStamp.h>
25 
26 #include <map>
27 
28 #include "qPCL.h"
29 
30 class vtkProp;
31 class vtkRenderer;
32 
46  : public vtkOpenGLHardwareSelector {
47 public:
49  vtkTypeMacro(cvHardwareSelector, vtkOpenGLHardwareSelector);
50  void PrintSelf(ostream& os, vtkIndent indent) override;
51 
61  virtual vtkSelection* Select(int region[4]);
62 
72  vtkSelection* PolygonSelect(int* polygonPoints, vtkIdType count);
73 
82  virtual bool NeedToRenderForSelection();
83 
90  void InvalidateCachedSelection() { this->Modified(); }
91 
101  int AssignUniqueId(vtkProp* prop);
102 
104 
112  vtkSetMacro(PointPickingRadius, unsigned int);
113  vtkGetMacro(PointPickingRadius, unsigned int);
115 
116  // Fixes a -Woverloaded-virtual warning
117  using vtkOpenGLHardwareSelector::BeginRenderProp;
118 
122  void BeginRenderProp(vtkRenderWindow* rw) override;
123 
127  void BeginSelection() override;
128 
132  void EndSelection() override;
133 
134 protected:
136  ~cvHardwareSelector() override;
137 
143  int GetPropID(int idx, vtkProp* prop) override;
144 
150  bool PassRequired(int pass) override;
151 
160  bool PrepareSelect();
161 
165  void SavePixelBuffer(int passNo) override;
166 
168  vtkTimeStamp CaptureTime;
169 
171  int UniqueId;
172 
174  unsigned int PointPickingRadius;
175 
176 private:
177  cvHardwareSelector(const cvHardwareSelector&) = delete;
178  void operator=(const cvHardwareSelector&) = delete;
179 
181  std::map<void*, int> PropMap;
182 };
183 
184 #endif // cvHardwareSelector_h
int count
Hardware selector with ParaView-style buffer caching.
void InvalidateCachedSelection()
Invalidate the cached selection buffers.
int UniqueId
Counter for unique prop IDs.
vtkTypeMacro(cvHardwareSelector, vtkOpenGLHardwareSelector)
vtkSetMacro(PointPickingRadius, unsigned int)
Point picking radius (in pixels)
vtkTimeStamp CaptureTime
Time when buffers were last captured.
static cvHardwareSelector * New()
vtkGetMacro(PointPickingRadius, unsigned int)
unsigned int PointPickingRadius
Point picking radius in pixels (default: 10)
#define QPCL_ENGINE_LIB_API
Definition: qPCL.h:15