#pragma once #define DllExport __declspec(dllexport) extern "C" { /// /// 初始化Recast引擎 /// /// DllExport bool recast_init(); /// /// 结束化Recast引擎 /// /// DllExport void recast_fini(); /// /// 加载地图数据,支持同时打开多张地图,用id来查找 /// /// 地图Id /// 地图文件名(含路径) /// DllExport bool recast_loadmap(int id, const char* path); /// /// 释放地图数据 /// /// 地图Id /// DllExport bool recast_freemap(int id); /// /// 寻路,寻路的结果其实只是返回从起点到终点之间所有经过的凸多边形的序号 /// /// 地图Id /// 起点坐标,float[3] /// 终点坐标,float[3] /// 返回寻路结果:1u << 30 - 成功;1u << 31 - 失败;1u << 29 - 寻路未完成,详细内容见:DetourStatus.h DllExport int recast_findpath(int id, const float* spos, const float* epos); /// /// 计算平滑路径,其实是根据findpath得到的【从起点到终点所经过的凸多边形的序号】,得到真正的路径(三维坐标),所以这一步是不可缺少的 /// /// 地图Id /// 平滑参数,步长,越小越平滑,如果给0,则自动变为0.5 /// 用途不明(但肯定不影响平滑),如果给0,则自动变为0.01 /// DllExport bool recast_smooth(int id, float step_size, float slop); /// /// 射线检测,从起始位置向终点位置发射一个射线,中间遇到阻挡停止,并返回阻挡Poly /// /// 地图Id /// 起点坐标,float[3] /// 终点坐标,float[3] /// 返回寻路结果:1u << 30 - 成功;1u << 31 - 失败;1u << 29 - /// 寻路未完成,详细内容见:DetourStatus.h DllExport int recast_raycast(int id, const float* spos, const float* epos); /// /// 获取射线检测的碰撞点,配合recast_raycast()函数使用 /// /// 地图Id /// 返回碰撞点坐标 DllExport float* recast_gethitposition(int id); /// /// 寻路后,得到路线经过的凸多边形id的个数 /// /// 地图Id /// DllExport int recast_getcountpoly(int id); /// /// 寻路后,得到具体的路径节点的个数 /// /// 地图Id /// DllExport int recast_getcountsmooth(int id); /// /// 得到pathfind以后,从起点到终点所经过的所有凸多边形id的序列 /// /// 地图Id /// 得到凸多边形id的序列 DllExport unsigned int* recast_getpathpoly(int id); /// /// 得到smooth以后,路线的三维坐标序列 /// /// 地图Id /// 得到寻路坐标序列,每(x,y,z)三个数值为一个单元,所以实际返回的数量是smoothCount的3倍 DllExport float* recast_getpathsmooth(int id); /// /// 修正坐标 /// /// 地图Id /// 坐标,float[3] /// 得到修复后的坐标点 DllExport float* recast_getfixposition(int id, const float* pos); }