ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
cvHardwareSelector Class Reference

Hardware selector with ParaView-style buffer caching. More...

#include <cvHardwareSelector.h>

Inheritance diagram for cvHardwareSelector:
[legend]
Collaboration diagram for cvHardwareSelector:
[legend]

Public Member Functions

 vtkTypeMacro (cvHardwareSelector, vtkOpenGLHardwareSelector)
 
void PrintSelf (ostream &os, vtkIndent indent) override
 
virtual vtkSelection * Select (int region[4])
 Perform selection over the specified region. More...
 
vtkSelection * PolygonSelect (int *polygonPoints, vtkIdType count)
 Perform polygon selection. More...
 
virtual bool NeedToRenderForSelection ()
 Check if next Select() will need to render. More...
 
void InvalidateCachedSelection ()
 Invalidate the cached selection buffers. More...
 
int AssignUniqueId (vtkProp *prop)
 Assign a unique ID to a prop. More...
 
void BeginRenderProp (vtkRenderWindow *rw) override
 Begin render prop (sets ProcessID) More...
 
void BeginSelection () override
 Begin selection - sets selector on renderer. More...
 
void EndSelection () override
 End selection - clears selector from renderer. More...
 
 vtkSetMacro (PointPickingRadius, unsigned int)
 Point picking radius (in pixels) More...
 
 vtkGetMacro (PointPickingRadius, unsigned int)
 

Static Public Member Functions

static cvHardwareSelector * New ()
 

Protected Member Functions

 cvHardwareSelector ()
 
 ~cvHardwareSelector () override
 
int GetPropID (int idx, vtkProp *prop) override
 Return a unique ID for the prop. More...
 
bool PassRequired (int pass) override
 Check if a pass is required. More...
 
bool PrepareSelect ()
 Prepare for selection. More...
 
void SavePixelBuffer (int passNo) override
 Save pixel buffer (with optional debug output) More...
 

Protected Attributes

vtkTimeStamp CaptureTime
 Time when buffers were last captured. More...
 
int UniqueId
 Counter for unique prop IDs. More...
 
unsigned int PointPickingRadius
 Point picking radius in pixels (default: 10) More...
 

Detailed Description

Hardware selector with ParaView-style buffer caching.

vtkOpenGLHardwareSelector subclass with ParaView-style buffer caching

This class extends vtkOpenGLHardwareSelector to add logic for reusing captured buffers as much as possible, avoiding repeated selection-rendering.

Key features (from ParaView):

  • Buffer caching with CaptureTime tracking
  • Point picking radius support
  • Polygon selection support
  • Unique prop ID assignment

This class is adapted from ParaView's vtkPVHardwareSelector to provide optimized hardware selection with buffer caching. It avoids recapturing buffers unless needed, improving selection performance.

Reference: ParaView/Remoting/Views/vtkPVHardwareSelector.h

Constructor & Destructor Documentation

◆ cvHardwareSelector()

cvHardwareSelector::cvHardwareSelector ( )
protected

References PointPickingRadius, and UniqueId.

◆ ~cvHardwareSelector()

cvHardwareSelector::~cvHardwareSelector ( )
overrideprotected

Member Function Documentation

◆ AssignUniqueId()

int cvHardwareSelector::AssignUniqueId ( vtkProp *  prop)

Assign a unique ID to a prop.

Used for tracking props during selection. Reference: vtkPVHardwareSelector::AssignUniqueId()

Parameters
propThe prop to assign an ID to
Returns
The assigned unique ID

References UniqueId.

◆ BeginRenderProp()

void cvHardwareSelector::BeginRenderProp ( vtkRenderWindow *  rw)
override

Begin render prop (sets ProcessID)

◆ BeginSelection()

void cvHardwareSelector::BeginSelection ( )
override

Begin selection - sets selector on renderer.

◆ EndSelection()

void cvHardwareSelector::EndSelection ( )
override

End selection - clears selector from renderer.

◆ GetPropID()

int cvHardwareSelector::GetPropID ( int  idx,
vtkProp *  prop 
)
overrideprotected

Return a unique ID for the prop.

Reference: vtkPVHardwareSelector::GetPropID()

◆ InvalidateCachedSelection()

void cvHardwareSelector::InvalidateCachedSelection ( )
inline

Invalidate the cached selection buffers.

Call this when the scene has changed and cached buffers are no longer valid. Reference: vtkPVHardwareSelector::InvalidateCachedSelection()

◆ NeedToRenderForSelection()

bool cvHardwareSelector::NeedToRenderForSelection ( )
virtual

Check if next Select() will need to render.

Returns true when the next call to Select() will result in renders to capture the selection-buffers.

Reference: vtkPVHardwareSelector::NeedToRenderForSelection()

References CaptureTime.

Referenced by PrepareSelect().

◆ New()

static cvHardwareSelector* cvHardwareSelector::New ( )
static

◆ PassRequired()

bool cvHardwareSelector::PassRequired ( int  pass)
overrideprotected

Check if a pass is required.

Reference: vtkPVHardwareSelector::PassRequired()

◆ PolygonSelect()

vtkSelection * cvHardwareSelector::PolygonSelect ( int *  polygonPoints,
vtkIdType  count 
)

Perform polygon selection.

Reference: vtkPVHardwareSelector::PolygonSelect()

Parameters
polygonPointsArray of polygon points
countNumber of points
Returns
Selection result (caller must Delete())

References count, and PrepareSelect().

◆ PrepareSelect()

bool cvHardwareSelector::PrepareSelect ( )
protected

Prepare for selection.

Captures buffers if needed. Reference: vtkPVHardwareSelector::PrepareSelect()

Returns
true if ready for selection, false if capture failed

References CaptureTime, CVLog::Error(), NeedToRenderForSelection(), origin, and size.

Referenced by PolygonSelect(), and Select().

◆ PrintSelf()

void cvHardwareSelector::PrintSelf ( ostream &  os,
vtkIndent  indent 
)
override

References PointPickingRadius, and UniqueId.

◆ SavePixelBuffer()

void cvHardwareSelector::SavePixelBuffer ( int  passNo)
overrideprotected

Save pixel buffer (with optional debug output)

◆ Select()

vtkSelection * cvHardwareSelector::Select ( int  region[4])
virtual

Perform selection over the specified region.

This method avoids clearing captured buffers if they are still valid. Reference: vtkPVHardwareSelector::Select()

Parameters
regionSelection region [x1, y1, x2, y2]
Returns
Selection result (caller must Delete())

References CVLog::Error(), PointPickingRadius, and PrepareSelect().

◆ vtkGetMacro()

cvHardwareSelector::vtkGetMacro ( PointPickingRadius  ,
unsigned int   
)

◆ vtkSetMacro()

cvHardwareSelector::vtkSetMacro ( PointPickingRadius  ,
unsigned int   
)

Point picking radius (in pixels)

When selecting a single point and no hit is found at the exact pixel, search in this radius for nearby points.

Reference: vtkPVRenderViewSettings::GetPointPickingRadius()

◆ vtkTypeMacro()

cvHardwareSelector::vtkTypeMacro ( cvHardwareSelector  ,
vtkOpenGLHardwareSelector   
)

Member Data Documentation

◆ CaptureTime

vtkTimeStamp cvHardwareSelector::CaptureTime
protected

Time when buffers were last captured.

Referenced by NeedToRenderForSelection(), and PrepareSelect().

◆ PointPickingRadius

unsigned int cvHardwareSelector::PointPickingRadius
protected

Point picking radius in pixels (default: 10)

Referenced by cvHardwareSelector(), PrintSelf(), and Select().

◆ UniqueId

int cvHardwareSelector::UniqueId
protected

Counter for unique prop IDs.

Referenced by AssignUniqueId(), cvHardwareSelector(), and PrintSelf().


The documentation for this class was generated from the following files: