25 #include <csgeom/math3d.h> 26 #include <csgeom/vector3.h> 27 #include <cstool/mapnode.h> 28 #include <csutil/csstring.h> 29 #include <csutil/hash.h> 30 #include <csutil/scf_implementation.h> 31 #include <iengine/sector.h> 32 #include <iutil/comp.h> 33 #include <iutil/document.h> 34 #include <iutil/objreg.h> 35 #include <ivaria/mapnode.h> 36 #include <tools/celgraph.h> 37 #include <tools/celnavmesh.h> 38 #include <tools/celhpf.h> 51 csRef<iCelPath> hlPath;
52 csHash<csRef<iCelNavMesh>, csPtrKey<iSector> >& navMeshes;
53 csArray<csRef<iCelNavMeshPath> > llPaths;
54 size_t currentllPosition;
55 csRef<iMapNode> currentNode;
56 csPtrKey<iSector> currentSector;
57 csRef<iMapNode> firstNode;
58 csRef<iMapNode> lastNode;
59 csArray<csSimpleRenderMesh*>* debugMeshes;
64 virtual bool HasNextInternal (
bool rev)
const;
65 virtual iMapNode* NextInternal (
bool rev);
68 celHPath (csHash<csRef<iCelNavMesh>, csPtrKey<iSector> >& navMeshes);
74 virtual bool HasNext ()
const;
75 virtual bool HasPrevious ()
const;
76 virtual iMapNode* Next ();
77 virtual iMapNode* Previous ();
78 virtual iMapNode* Current ();
79 virtual iMapNode* GetFirst ();
80 virtual iMapNode* GetLast ();
81 virtual void Invert ();
82 virtual void Restart ();
83 virtual float GetDistance ()
const;
84 virtual csArray<csSimpleRenderMesh*>* GetDebugMeshes ();
95 iObjectRegistry* objectRegistry;
96 csRef<iCelNavMeshParams> parameters;
97 csHash<csRef<iCelNavMesh>, csPtrKey<iSector> > navMeshes;
98 csRef<iCelGraph> hlGraph;
100 csArray<csSimpleRenderMesh*>* debugMeshes;
103 void SaveParameters (iDocumentNode* node);
104 void SaveNavMeshes (iDocumentNode* node, iVFS* vfs);
105 void SaveHighLevelGraph (iDocumentNode* node1, iDocumentNode* node2);
108 celHNavStruct (
const iCelNavMeshParams* params, iObjectRegistry* objectRegistry);
109 virtual ~celHNavStruct ();
111 void AddNavMesh(iCelNavMesh* navMesh);
112 bool BuildHighLevelGraph();
113 void SetHighLevelGraph(iCelGraph* graph);
116 virtual iCelHPath* ShortestPath (
const csVector3& from, iSector* fromSector,
const csVector3& goal,
117 iSector* goalSector);
118 virtual iCelHPath* ShortestPath (iMapNode* from, iMapNode* goal);
119 virtual bool Update (
const csBox3& boundingBox, iSector* sector = 0);
120 virtual bool Update (
const csOBB& boundingBox, iSector* sector = 0);
121 virtual bool SaveToFile (iVFS* vfs,
const char* directory);
122 virtual const iCelNavMeshParams* GetNavMeshParams ()
const;
123 virtual csArray<csSimpleRenderMesh*>* GetDebugMeshes (iSector* sector = 0);
124 virtual csArray<csSimpleRenderMesh*>* GetAgentDebugMeshes (
const csVector3& pos,
int red,
int green,
125 int blue,
int alpha);
126 virtual void ResetAgentDebugMeshes ();
134 class celHNavStructBuilder :
public scfImplementation2<celHNavStructBuilder, iCelHNavStructBuilder, iComponent>
137 iObjectRegistry* objectRegistry;
138 csRef<iCelNavMeshParams> parameters;
139 csRefArray<iSector> sectors;
140 csHash<csRef<iCelNavMeshBuilder>, csPtrKey<iSector> > builders;
141 csRef<celHNavStruct> navStruct;
143 bool InstantiateNavMeshBuilders();
146 bool ParseParameters (iDocumentNode* node, iCelNavMeshParams* params);
147 bool ParseMeshes (iDocumentNode* node, csHash<csRef<iSector>,
const char*>& sectors,
148 celHNavStruct* navStruct, iVFS* vfs, iCelNavMeshParams* params);
149 bool ParseGraph (iDocumentNode* node, iCelGraph* graph, csHash<csRef<iSector>,
const char*>& sectors);
152 celHNavStructBuilder (
iBase* parent);
153 virtual ~celHNavStructBuilder ();
157 virtual bool SetSectors (csRefArray<iSector>* sectorList);
158 virtual iCelHNavStruct* BuildHNavStruct ();
159 virtual iCelHNavStruct* LoadHNavStruct (iVFS* vfs,
const char* directory);
160 virtual const iCelNavMeshParams* GetNavMeshParams ()
const;
161 virtual void SetNavMeshParams (
const iCelNavMeshParams* parameters);
165 CS_PLUGIN_NAMESPACE_END(celNavMesh)
167 #endif // __CEL_HPF__
void void Initialize(iObjectRegistry *object_reg)
CS_PLUGIN_NAMESPACE_BEGIN(celNavMesh)