Panda3D
|
00001 00002 //////////////////////////////////////////////////////////////////////// 00003 // Filename : pathFind.h 00004 // Created by : Deepak, John, Navin 00005 // Date : 12 Oct 09 00006 //////////////////////////////////////////////////////////////////// 00007 // 00008 // PANDA 3D SOFTWARE 00009 // Copyright (c) Carnegie Mellon University. All rights reserved. 00010 // 00011 // All use of this software is subject to the terms of the revised BSD 00012 // license. You should have received a copy of this license along 00013 // with this source code in a file named "LICENSE." 00014 // 00015 //////////////////////////////////////////////////////////////////// 00016 00017 #ifndef _PATHFIND_H 00018 #define _PATHFIND_H 00019 00020 #include "aiGlobals.h" 00021 #include "aiCharacter.h" 00022 #include "aiPathFinder.h" 00023 #include "boundingSphere.h" 00024 00025 class AICharacter; 00026 00027 //////////////////////////////////////////////////////////////////////////////////////////////////////////////// 00028 // 00029 // Class : PathFind 00030 // Description : This class contains all the members and functions that are required to form an interface between 00031 // the AIBehaviors class and the PathFinder class. An object (pointer) of this class is provided in the 00032 // AIBehaviors class. It is only via this object that the user can activate pathfinding. 00033 00034 //////////////////////////////////////////////////////////////////////////////////////////////////////////////// 00035 00036 class EXPCL_PANDAAI PathFind { 00037 public: 00038 AICharacter *_ai_char; 00039 PathFinder *_path_finder_obj; 00040 00041 NavMesh _nav_mesh; 00042 NavMesh _stage_mesh; 00043 00044 int _grid_size; 00045 NodePath _path_find_target; 00046 LVecBase3f _prev_position; 00047 PT(GeomNode) _parent; 00048 LineSegs *_pen; 00049 vector<int> _previous_obstacles; 00050 bool _dynamic_avoid; 00051 vector<NodePath> _dynamic_obstacle; 00052 00053 PathFind(AICharacter *ai_ch); 00054 ~PathFind(); 00055 00056 void clear_path(); 00057 void trace_path(Node* src); 00058 00059 void create_nav_mesh(const char* navmesh_filename); 00060 void assign_neighbor_nodes(const char* navmesh_filename); 00061 void do_dynamic_avoid(); 00062 void clear_previous_obstacles(); 00063 00064 void set_path_find(const char* navmesh_filename); 00065 void path_find(LVecBase3f pos, string type = "normal"); 00066 void path_find(NodePath target, string type = "normal"); 00067 void add_obstacle_to_mesh(NodePath obstacle); 00068 void dynamic_avoid(NodePath obstacle); 00069 }; 00070 00071 #endif 00072