2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
19 * All rights reserved.
21 * The Original Code is: all of this file.
23 * Contributor(s): none yet.
25 * ***** END GPL LICENSE BLOCK *****
27 #ifndef __KX_NAVMESHOBJECT_H__
28 #define __KX_NAVMESHOBJECT_H__
29 #include "DetourStatNavMesh.h"
30 #include "KX_GameObject.h"
31 #include "PyObjectPlus.h"
37 class KX_NavMeshObject: public KX_GameObject
42 dtStatNavMesh* m_navMesh;
44 bool BuildVertIndArrays(float *&vertices, int& nverts,
45 unsigned short* &polys, int& npolys, unsigned short *&dmeshes,
46 float *&dvertices, int &ndvertsuniq, unsigned short* &dtris,
47 int& ndtris, int &vertsPerPoly);
50 KX_NavMeshObject(void* sgReplicationInfo, SG_Callbacks callbacks);
53 virtual CValue* GetReplica();
54 virtual void ProcessReplica();
58 dtStatNavMesh* GetNavMesh();
59 int FindPath(const MT_Point3& from, const MT_Point3& to, float* path, int maxPathLen);
60 float Raycast(const MT_Point3& from, const MT_Point3& to);
62 enum NavMeshRenderMode {RM_WALLS, RM_POLYS, RM_TRIS, RM_MAX};
63 void DrawNavMesh(NavMeshRenderMode mode);
64 void DrawPath(const float *path, int pathLen, const MT_Vector3& color);
66 MT_Point3 TransformToLocalCoords(const MT_Point3& wpos);
67 MT_Point3 TransformToWorldCoords(const MT_Point3& lpos);
69 /* --------------------------------------------------------------------- */
70 /* Python interface ---------------------------------------------------- */
71 /* --------------------------------------------------------------------- */
73 KX_PYMETHOD_DOC(KX_NavMeshObject, findPath);
74 KX_PYMETHOD_DOC(KX_NavMeshObject, raycast);
75 KX_PYMETHOD_DOC(KX_NavMeshObject, draw);
76 KX_PYMETHOD_DOC_NOARGS(KX_NavMeshObject, rebuild);
80 #endif //__KX_NAVMESHOBJECT_H__