Picker Class Reference
[GUI]

Determines which item is under the mouse cursor. More...

#include <Picker.hpp>

List of all members.

Public Member Functions

 Picker (Scene *scene, Canvas *canvas)
void addManipulators (list< Manipulator * > manipulators)
pair< GLuint, GLuint > pick (int x, int y)

Protected Member Functions

pair< GLuint, GLuint > chooseItem ()
void finish ()
void initialize (int x, int y)
void storeIDsOfItems ()

Private Attributes

GLuint buf [PICK_BUFFER_SIZE]
map< GLuint, GLuint > ids
Painterpainter
Canvascanvas
Scenescene

Detailed Description

Determines which item is under the mouse cursor.


Member Function Documentation

pair< GLuint, GLuint > chooseItem (  )  [protected]

Choose the item to return.

Manipulators are returned before shapes, and if more than one shape is picked, the closest one to the camera is chosen.

void finish (  )  [protected]

Restores the original projection matrix.

void initialize ( int  x,
int  y 
) [protected]

Initializes the viewport, pick buffer, and projection matrix.

pair< GLuint, GLuint > pick ( int  x,
int  y 
)
Returns:
ID of item picked and shape it belongs to (UINT_MAX if nothing).
void storeIDsOfItems (  )  [protected]

Stores the IDs of the items picked.

A hit record is made up of at least four unsigned integers in the selection buffer, as shown below. There will be one hit record for each item under the mouse cursor. The exact number is returned by glRenderMode when switching back to GL_RENDER.

The first integer in a hit record is the number of IDs that were on the name stack when the item was drawn, which should always be one. The second and third values are the minimum and maximum depth values at the time. Finally, the IDs that were present on the name stack when the item was drawn are listed from bottom to top. In other words, the item under the cursor will be the nth item in the list, where n is equal to the number of IDs. ------------- | numOfIDs | | minDepth | | maxDepth | | ids | | ... | -------------

Exceptions:
Exception if a hit record with 0 item IDs was detected.

The documentation for this class was generated from the following files:
Generated on Wed Jun 9 01:36:36 2010 for Gander by  doxygen 1.6.3