00001 #ifndef Octree_Data_Fuser_h 00002 #define Octree_Data_Fuser_h 1 00003 //Octree_Data_Fuser 00004 00005 00006 00007 #include "Universe\Universe.h" 00008 #include "robots\R_OpenChain.h" 00009 #include "CollisionDetectors\CD_Vcollide.h" 00010 #include "OpenGL\GL_Universe.h" 00011 #include "OpenGL\GL_Mesh.h" 00012 #include "logical.h" 00013 #include "octree.h" 00014 #include <set> 00015 #include <algorithm> 00016 #include <iterator> 00017 #include <functional> 00018 00019 //octree_display_mode values: 00020 const int octree_nodisplay = 0; 00021 const int octree_whitedisplay = 1; 00022 const int octree_blackdisplay = 2; 00023 const int octree_obstacledisplay = 3; 00024 00025 00026 class Octree_Data_Fuser 00027 { 00028 public: 00029 00030 #ifdef WIN32 00031 CWnd* cWindow_ptr; 00032 00033 HGLRC hglrc_var; 00034 #endif 00035 00036 //construct_octree resolution values: 00037 // maxlevel == 6 "low" 00038 // maxlevel == 7 standard 00039 // maxlevel == 8 maximum 00040 int maxlevel; 00041 int octree_display_mode; 00042 bool track_sensed_obstacles; 00043 int expected_vertexes; 00044 int expected_facets; 00045 int expected_squarevectors; 00046 double scalefactor; //where 30.0 is the world x,y and z extents from (0,0,0) 00047 00048 Configuration showconfig; 00049 00050 Octree_Data_Fuser(); 00051 00052 Octree_Data_Fuser (const Octree_Data_Fuser& right); 00053 00054 ~Octree_Data_Fuser(); 00055 00056 void Save_State(const char * filename); 00057 void Load_State(const char * filename); 00058 00059 //updates local universe with block info 00060 void Add_Block(cubic worldextents, cubic newblocksize); 00061 00062 //takes in null lv pointer, makes it point to a valid octree mesh vcollide object 00063 void Convert (CD_Vcollide* &lv_free, CD_Vcollide* &lv_obstacle, 00064 Universe &robot_universe, bool valid_config); 00065 00066 //updates the local universe with camera info 00067 void Update (Range_Sensor *camera); 00068 00069 //displays current local universe *lu onto OpenGL window 00070 void GL_Display_Octree (); 00071 00072 protected: 00073 00074 std::set<PointClass> obstacle_points; 00075 00076 GL_Universe* lu; //local universe pointer 00077 00078 GL_Universe* display_lu; //local universe pointer to display universe 00079 00080 OctreeNode* root2; //pointer to root of local octree 00081 00082 //creates a local universe using only knoledge of robot, not obstacles 00083 void new_local_universe (Universe &robot_universe); 00084 00085 }; 00086 00087 #endif