Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Examples  

Picking.H

Go to the documentation of this file.
00001 
00018 #ifndef _PICKING_H
00019 #define _PICKING_H
00020 
00021 #include <GL/gl.h>
00022 #include <iostream>
00023 #include <UserInterface.H>
00024 
00025 namespace xchen
00026 {
00027   class UI :: Picking 
00028   {
00029       enum { invalid_selected_id = -1 };   // must be <0 since the selected_id is used as array index in glModel.
00030 
00031       enum { hit_buff_sz = 1024 };
00032   public:
00033       Picking() : selected_id(invalid_selected_id)                          { }
00034       void operator()(int x, int y, double width=4.0, double height=4.0);
00035 
00036       int GetSelected()                                                     { return selected_id; }
00037       bool IsSelected()                                                     { return selected_id >= 0 ; }
00038       void UnSelect()                                                       { selected_id = invalid_selected_id; }
00039 
00040   private:
00041       int selected_id;
00042 
00043       GLuint selectBuf[hit_buff_sz];
00044       GLint hits;
00045       void processHits();
00046   };
00047 
00048 }
00049 
00050 #endif
00051 

Generated on Wed Apr 7 21:40:49 2004 by doxygen1.2.18