VTK
|
manager for OpenGL-based selection. More...
#include <vtkHardwareSelector.h>
Classes | |
struct | PixelInformation |
Public Types | |
enum | PassTypes { PROCESS_PASS, ACTOR_PASS, COMPOSITE_INDEX_PASS, ID_LOW24, ID_MID24, ID_HIGH16, MAX_KNOWN_PASS = ID_HIGH16, MIN_KNOWN_PASS = PROCESS_PASS } |
typedef vtkObject | Superclass |
Public Types inherited from vtkObject | |
typedef vtkObjectBase | Superclass |
Public Member Functions | |
virtual int | IsA (const char *type) |
vtkHardwareSelector * | NewInstance () const |
void | PrintSelf (ostream &os, vtkIndent indent) |
vtkSelection * | Select () |
virtual void | RenderCompositeIndex (unsigned int index) |
virtual void | RenderAttributeId (vtkIdType attribid) |
virtual void | RenderProcessId (unsigned int processid) |
int | Render (vtkRenderer *renderer, vtkProp **propArray, int propArrayCount) |
vtkProp * | GetPropFromID (int id) |
virtual void | SetRenderer (vtkRenderer *) |
virtual vtkRenderer * | GetRenderer () |
virtual void | SetArea (unsigned int, unsigned int, unsigned int, unsigned int) |
virtual void | SetArea (unsigned int[4]) |
virtual unsigned int * | GetArea () |
virtual void | GetArea (unsigned int &, unsigned int &, unsigned int &, unsigned int &) |
virtual void | GetArea (unsigned int[4]) |
virtual void | SetFieldAssociation (int) |
virtual int | GetFieldAssociation () |
virtual void | SetUseProcessIdFromData (bool) |
virtual bool | GetUseProcessIdFromData () |
virtual bool | CaptureBuffers () |
PixelInformation | GetPixelInformation (const unsigned int display_position[2]) |
PixelInformation | GetPixelInformation (const unsigned int display_position[2], int maxDist) |
PixelInformation | GetPixelInformation (const unsigned int display_position[2], int maxDist, unsigned int selected_position[2]) |
void | ClearBuffers () |
virtual void | BeginRenderProp () |
virtual void | EndRenderProp () |
virtual void | SetProcessID (int) |
virtual int | GetProcessID () |
virtual float * | GetPropColorValue () |
virtual void | GetPropColorValue (float &, float &, float &) |
virtual void | GetPropColorValue (float[3]) |
virtual void | SetPropColorValue (float, float, float) |
virtual void | SetPropColorValue (float[3]) |
virtual int | GetCurrentPass () |
virtual vtkSelection * | GenerateSelection () |
virtual vtkSelection * | GenerateSelection (unsigned int r[4]) |
virtual vtkSelection * | GenerateSelection (unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2) |
virtual vtkSelection * | GeneratePolygonSelection (int *polygonPoints, vtkIdType count) |
Public Member Functions inherited from vtkObject | |
vtkObject * | NewInstance () const |
virtual void | DebugOn () |
virtual void | DebugOff () |
bool | GetDebug () |
void | SetDebug (bool debugFlag) |
virtual void | Modified () |
virtual unsigned long | GetMTime () |
unsigned long | AddObserver (unsigned long event, vtkCommand *, float priority=0.0f) |
unsigned long | AddObserver (const char *event, vtkCommand *, float priority=0.0f) |
vtkCommand * | GetCommand (unsigned long tag) |
void | RemoveObserver (vtkCommand *) |
void | RemoveObservers (unsigned long event, vtkCommand *) |
void | RemoveObservers (const char *event, vtkCommand *) |
int | HasObserver (unsigned long event, vtkCommand *) |
int | HasObserver (const char *event, vtkCommand *) |
void | RemoveObserver (unsigned long tag) |
void | RemoveObservers (unsigned long event) |
void | RemoveObservers (const char *event) |
void | RemoveAllObservers () |
int | HasObserver (unsigned long event) |
int | HasObserver (const char *event) |
template<class U , class T > | |
unsigned long | AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f) |
template<class U , class T > | |
unsigned long | AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f) |
template<class U , class T > | |
unsigned long | AddObserver (unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f) |
int | InvokeEvent (unsigned long event, void *callData) |
int | InvokeEvent (const char *event, void *callData) |
int | InvokeEvent (unsigned long event) |
int | InvokeEvent (const char *event) |
Public Member Functions inherited from vtkObjectBase | |
const char * | GetClassName () const |
virtual void | Delete () |
virtual void | FastDelete () |
void | Print (ostream &os) |
virtual void | Register (vtkObjectBase *o) |
virtual void | UnRegister (vtkObjectBase *o) |
void | SetReferenceCount (int) |
void | PrintRevisions (ostream &) |
virtual void | PrintHeader (ostream &os, vtkIndent indent) |
virtual void | PrintTrailer (ostream &os, vtkIndent indent) |
int | GetReferenceCount () |
Static Public Member Functions | |
static vtkHardwareSelector * | New () |
static int | IsTypeOf (const char *type) |
static vtkHardwareSelector * | SafeDownCast (vtkObjectBase *o) |
static void | Convert (int id, float tcoord[3]) |
Static Public Member Functions inherited from vtkObject | |
static int | IsTypeOf (const char *type) |
static vtkObject * | SafeDownCast (vtkObjectBase *o) |
static vtkObject * | New () |
static void | BreakOnError () |
static void | SetGlobalWarningDisplay (int val) |
static void | GlobalWarningDisplayOn () |
static void | GlobalWarningDisplayOff () |
static int | GetGlobalWarningDisplay () |
Static Public Member Functions inherited from vtkObjectBase | |
static int | IsTypeOf (const char *name) |
static vtkObjectBase * | New () |
Protected Member Functions | |
virtual vtkObjectBase * | NewInstanceInternal () const |
vtkHardwareSelector () | |
~vtkHardwareSelector () | |
virtual void | BeginRenderProp (vtkRenderWindow *)=0 |
virtual void | EndRenderProp (vtkRenderWindow *)=0 |
int | Convert (unsigned long offset, unsigned char *pb) |
vtkIdType | GetID (int low24, int mid24, int high16) |
virtual bool | PassRequired (int pass) |
bool | IsPropHit (int propid) |
virtual void | BeginSelection () |
virtual void | EndSelection () |
virtual void | SavePixelBuffer (int passNo) |
void | BuildPropHitList (unsigned char *rgbData) |
int | Convert (unsigned int pos[2], unsigned char *pb) |
int | Convert (int xx, int yy, unsigned char *pb) |
virtual int | GetPropID (int idx, vtkProp *vtkNotUsed(prop)) |
Protected Member Functions inherited from vtkObject | |
vtkObject () | |
virtual | ~vtkObject () |
virtual void | RegisterInternal (vtkObjectBase *, int check) |
virtual void | UnRegisterInternal (vtkObjectBase *, int check) |
void | InternalGrabFocus (vtkCommand *mouseEvents, vtkCommand *keypressEvents=NULL) |
void | InternalReleaseFocus () |
Protected Member Functions inherited from vtkObjectBase | |
vtkObjectBase () | |
virtual | ~vtkObjectBase () |
virtual void | CollectRevisions (ostream &) |
virtual void | ReportReferences (vtkGarbageCollector *) |
vtkObjectBase (const vtkObjectBase &) | |
void | operator= (const vtkObjectBase &) |
Protected Attributes | |
unsigned char * | PixBuffer [10] |
int | ProcessID |
int | CurrentPass |
int | InPropRender |
int | PropID |
float | PropColorValue [3] |
Protected Attributes inherited from vtkObject | |
bool | Debug |
vtkTimeStamp | MTime |
vtkSubjectHelper * | SubjectHelper |
Protected Attributes inherited from vtkObjectBase | |
vtkAtomicInt32 | ReferenceCount |
vtkWeakPointerBase ** | WeakPointers |
vtkRenderer * | Renderer |
unsigned int | Area [4] |
int | FieldAssociation |
bool | UseProcessIdFromData |
vtkIdType | MaxAttributeId |
void | ReleasePixBuffers () |
manager for OpenGL-based selection.
vtkHardwareSelector is a helper that orchestrates color buffer based selection. This relies on OpenGL. vtkHardwareSelector can be used to select visible cells or points within a given rectangle of the RenderWindow. To use it, call in order:
Limitations: Antialiasing will break this class. If your graphics card settings force their use this class will return invalid results.
Currently only cells from PolyDataMappers can be selected from. When vtkRenderer::Selector is non-null vtkPainterPolyDataMapper uses the vtkHardwareSelectionPolyDataPainter which make appropriate calls to BeginRenderProp(), EndRenderProp(), RenderProcessId(), RenderAttributeId() to render colors correctly. Until alternatives to vtkHardwareSelectionPolyDataPainter exist that can do a similar coloration of other vtkDataSet types, only polygonal data can be selected. If you need to select other data types, consider using vtkDataSetMapper and turning on it's PassThroughCellIds feature, or using vtkFrustumExtractor.
Only Opaque geometry in Actors is selected from. Assemblies and LODMappers are not currently supported.
During selection, visible datasets that can not be selected from are temporarily hidden so as not to produce invalid indices from their colors.
Definition at line 75 of file vtkHardwareSelector.h.
Definition at line 99 of file vtkHardwareSelector.h.
Enumerator | |
---|---|
PROCESS_PASS | |
ACTOR_PASS | |
COMPOSITE_INDEX_PASS | |
ID_LOW24 | |
ID_MID24 | |
ID_HIGH16 | |
MAX_KNOWN_PASS | |
MIN_KNOWN_PASS |
Definition at line 231 of file vtkHardwareSelector.h.
|
protected |
|
protected |
|
static |
|
static |
|
virtual |
Return 1 if this class is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.
Reimplemented from vtkObject.
Reimplemented in vtkPHardwareSelector, vtkOpenGLHardwareSelector, and vtkOpenGLHardwareSelector.
|
static |
|
protectedvirtual |
Reimplemented from vtkObject.
Reimplemented in vtkPHardwareSelector, vtkOpenGLHardwareSelector, and vtkOpenGLHardwareSelector.
vtkHardwareSelector* vtkHardwareSelector::NewInstance | ( | ) | const |
|
virtual |
Methods invoked by print to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.
Reimplemented from vtkObject.
Reimplemented in vtkPHardwareSelector, vtkOpenGLHardwareSelector, and vtkOpenGLHardwareSelector.
|
virtual |
Get/Set the renderer to perform the selection on.
|
virtual |
Get/Set the renderer to perform the selection on.
|
virtual |
Get/Set the area to select as (xmin, ymin, xmax, ymax).
|
virtual |
Get/Set the area to select as (xmin, ymin, xmax, ymax).
|
virtual |
Get/Set the area to select as (xmin, ymin, xmax, ymax).
|
virtual |
Get/Set the area to select as (xmin, ymin, xmax, ymax).
|
virtual |
Get/Set the area to select as (xmin, ymin, xmax, ymax).
|
virtual |
Set the field type to select. Valid values are
|
virtual |
Set the field type to select. Valid values are
|
virtual |
In some parallel rendering setups, the process id for elements must be obtained from the data itself, rather than the rendering process' id. In that case, set this flag to ON (default OFF).
|
virtual |
In some parallel rendering setups, the process id for elements must be obtained from the data itself, rather than the rendering process' id. In that case, set this flag to ON (default OFF).
vtkSelection* vtkHardwareSelector::Select | ( | ) |
Perform the selection. Returns a new instance of vtkSelection containing the selection on success.
|
virtual |
It is possible to use the vtkHardwareSelector for a custom picking. (Look at vtkScenePicker). In that case instead of Select() on can use CaptureBuffers() to render the selection buffers and then get information about pixel locations suing GetPixelInformation(). Use ClearBuffers() to clear buffers after one's done with the scene. The optional final parameter maxDist will look for a cell within the specified number of pixels from display_position. When using the overload with the optional selected_position
argument, selected_position is filled with the position for which the PixelInformation is being returned. This is useful when maxDist > 0 to determine which position's pixel information is was returned.
Reimplemented in vtkPHardwareSelector.
|
inline |
It is possible to use the vtkHardwareSelector for a custom picking. (Look at vtkScenePicker). In that case instead of Select() on can use CaptureBuffers() to render the selection buffers and then get information about pixel locations suing GetPixelInformation(). Use ClearBuffers() to clear buffers after one's done with the scene. The optional final parameter maxDist will look for a cell within the specified number of pixels from display_position. When using the overload with the optional selected_position
argument, selected_position is filled with the position for which the PixelInformation is being returned. This is useful when maxDist > 0 to determine which position's pixel information is was returned.
Definition at line 151 of file vtkHardwareSelector.h.
|
inline |
It is possible to use the vtkHardwareSelector for a custom picking. (Look at vtkScenePicker). In that case instead of Select() on can use CaptureBuffers() to render the selection buffers and then get information about pixel locations suing GetPixelInformation(). Use ClearBuffers() to clear buffers after one's done with the scene. The optional final parameter maxDist will look for a cell within the specified number of pixels from display_position. When using the overload with the optional selected_position
argument, selected_position is filled with the position for which the PixelInformation is being returned. This is useful when maxDist > 0 to determine which position's pixel information is was returned.
Definition at line 153 of file vtkHardwareSelector.h.
PixelInformation vtkHardwareSelector::GetPixelInformation | ( | const unsigned int | display_position[2], |
int | maxDist, | ||
unsigned int | selected_position[2] | ||
) |
It is possible to use the vtkHardwareSelector for a custom picking. (Look at vtkScenePicker). In that case instead of Select() on can use CaptureBuffers() to render the selection buffers and then get information about pixel locations suing GetPixelInformation(). Use ClearBuffers() to clear buffers after one's done with the scene. The optional final parameter maxDist will look for a cell within the specified number of pixels from display_position. When using the overload with the optional selected_position
argument, selected_position is filled with the position for which the PixelInformation is being returned. This is useful when maxDist > 0 to determine which position's pixel information is was returned.
|
inline |
It is possible to use the vtkHardwareSelector for a custom picking. (Look at vtkScenePicker). In that case instead of Select() on can use CaptureBuffers() to render the selection buffers and then get information about pixel locations suing GetPixelInformation(). Use ClearBuffers() to clear buffers after one's done with the scene. The optional final parameter maxDist will look for a cell within the specified number of pixels from display_position. When using the overload with the optional selected_position
argument, selected_position is filled with the position for which the PixelInformation is being returned. This is useful when maxDist > 0 to determine which position's pixel information is was returned.
Definition at line 157 of file vtkHardwareSelector.h.
|
virtual |
Called by any vtkMapper or vtkProp subclass to render a composite-index. Currently indices >= 0xffffff are not supported.
Reimplemented in vtkOpenGLHardwareSelector.
|
virtual |
Called by any vtkMapper or vtkProp subclass to render an attribute's id.
Reimplemented in vtkOpenGLHardwareSelector.
|
virtual |
Called by any vtkMapper or subclass to render process id. This has any effect when this->UseProcessIdFromData is true.
Reimplemented in vtkOpenGLHardwareSelector.
int vtkHardwareSelector::Render | ( | vtkRenderer * | renderer, |
vtkProp ** | propArray, | ||
int | propArrayCount | ||
) |
Called by vtkRenderer to render the selection pass. Returns the number of props rendered.
|
virtual |
Called by the mapper (vtkHardwareSelectionPolyDataPainter) before and after rendering each prop.
Reimplemented in vtkOpenGLHardwareSelector, and vtkOpenGLHardwareSelector.
|
virtual |
Called by the mapper (vtkHardwareSelectionPolyDataPainter) before and after rendering each prop.
Reimplemented in vtkOpenGLHardwareSelector, and vtkOpenGLHardwareSelector.
|
virtual |
Get/Set the process id. If process id < 0 (default -1), then the PROCESS_PASS is not rendered.
|
virtual |
Get/Set the process id. If process id < 0 (default -1), then the PROCESS_PASS is not rendered.
|
virtual |
Get/Set the color to be used by the prop when drawing
Get/Set the color to be used by the prop when drawing
|
virtual |
Get/Set the color to be used by the prop when drawing
Get/Set the color to be used by the prop when drawing
|
virtual |
Get/Set the color to be used by the prop when drawing
|
virtual |
Get the current pass number.
|
inlinevirtual |
Generates the vtkSelection from pixel buffers. Requires that CaptureBuffers() has already been called. Optionally you may pass a screen region (xmin, ymin, xmax, ymax) to generate a selection from. The region must be a subregion of the region specified by SetArea(), otherwise it will be clipped to that region.
Definition at line 208 of file vtkHardwareSelector.h.
|
inlinevirtual |
Generates the vtkSelection from pixel buffers. Requires that CaptureBuffers() has already been called. Optionally you may pass a screen region (xmin, ymin, xmax, ymax) to generate a selection from. The region must be a subregion of the region specified by SetArea(), otherwise it will be clipped to that region.
Definition at line 210 of file vtkHardwareSelector.h.
|
virtual |
Generates the vtkSelection from pixel buffers. Requires that CaptureBuffers() has already been called. Optionally you may pass a screen region (xmin, ymin, xmax, ymax) to generate a selection from. The region must be a subregion of the region specified by SetArea(), otherwise it will be clipped to that region.
|
virtual |
Generates the vtkSelection from pixel buffers. Same as GenerateSelection, except this one use a polygon, instead of a rectangle region, and select elements inside the polygon. NOTE: The CaptureBuffers() needs to be called first.
returns the prop associated with a ID. This is valid only until ReleasePixBuffers() gets called.
Definition at line 243 of file vtkHardwareSelector.h.
|
protectedpure virtual |
Implemented in vtkOpenGLHardwareSelector, and vtkOpenGLHardwareSelector.
|
protectedpure virtual |
Implemented in vtkOpenGLHardwareSelector, and vtkOpenGLHardwareSelector.
|
inlineprotected |
Definition at line 259 of file vtkHardwareSelector.h.
pos
must be relative to the lower-left corner of this->Area.
Definition at line 281 of file vtkHardwareSelector.h.
pos
must be relative to the lower-left corner of this->Area.
Definition at line 283 of file vtkHardwareSelector.h.
Definition at line 304 of file vtkHardwareSelector.h.
|
protectedvirtual |
Returns is the pass indicated is needed.
|
protected |
After the ACTOR_PASS this return true or false depending upon whether the prop was hit in the ACTOR_PASS. This makes it possible to skip props that are not involved in the selection after the first pass.
|
inlineprotectedvirtual |
Return a unique ID for the prop.
Definition at line 325 of file vtkHardwareSelector.h.
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
Reimplemented in vtkOpenGLHardwareSelector.
|
protected |
|
protected |
Clears all pixel buffers.
|
protected |
Clears all pixel buffers.
Definition at line 338 of file vtkHardwareSelector.h.
|
protected |
Clears all pixel buffers.
Definition at line 339 of file vtkHardwareSelector.h.
|
protected |
Clears all pixel buffers.
Definition at line 340 of file vtkHardwareSelector.h.
|
protected |
Clears all pixel buffers.
Definition at line 341 of file vtkHardwareSelector.h.
|
protected |
Clears all pixel buffers.
Definition at line 342 of file vtkHardwareSelector.h.
|
protected |
Definition at line 346 of file vtkHardwareSelector.h.
|
protected |
Definition at line 347 of file vtkHardwareSelector.h.
|
protected |
Definition at line 348 of file vtkHardwareSelector.h.
|
protected |
Definition at line 349 of file vtkHardwareSelector.h.
|
protected |
Definition at line 350 of file vtkHardwareSelector.h.
|
protected |
Definition at line 351 of file vtkHardwareSelector.h.