| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- #include "RecastDll.h"
- #include "CRecastHelper.h"
- extern "C"
- {
- CRecastHelper* _helper = NULL;
- DllExport bool recast_init()
- {
- _helper = new CRecastHelper();
- return true;
- }
- void recast_fini()
- {
- if (_helper)
- delete _helper;
- _helper = NULL;
- }
- bool recast_loadmap(int id, const char* path)
- {
- if (!_helper) return false;
- if (!_helper->LoadMap(id, path))
- return false;
- return true;
- }
- bool recast_freemap(int id)
- {
- if (!_helper || !_helper->Get(id)) return false;
- _helper->FreeMap(id);
- return true;
- }
- int recast_findpath(int id, const float* spos, const float* epos)
- {
- if (!_helper || !_helper->Get(id)) return 0;
- dtStatus status = _helper->Get(id)->FindPath(spos, epos);
- return status;
- }
- bool recast_smooth(int id, float step_size, float slop)
- {
- if (!_helper || !_helper->Get(id)) return false;
- _helper->Get(id)->Smooth(step_size, slop);
- return true;
- }
- int recast_raycast(int id, const float* spos, const float* epos)
- {
- if (!_helper || !_helper->Get(id)) return 0;
- dtStatus status = _helper->Get(id)->Raycast(spos, epos);
- return status;
- }
- float* recast_gethitposition(int id)
- {
- if (!_helper || !_helper->Get(id)) return NULL;
- return _helper->Get(id)->GetHitPosition();
- }
- int recast_getcountpoly(int id)
- {
- if (!_helper || !_helper->Get(id)) return 0;
- return _helper->Get(id)->GetCountPoly();
- }
- int recast_getcountsmooth(int id)
- {
- if (!_helper || !_helper->Get(id)) return 0;
- return _helper->Get(id)->GetCountSmooth();
- }
- unsigned int* recast_getpathpoly(int id)
- {
- if (!_helper || !_helper->Get(id)) return NULL;
- int count = 0;
- unsigned int* polys = _helper->Get(id)->GetPathPoly(&count);
- if (count == 0)
- return NULL;
- return polys;
- }
- float* recast_getpathsmooth(int id)
- {
- if (!_helper || !_helper->Get(id)) return NULL;
- int count = 0;
- float* polys = _helper->Get(id)->GetPathSmooth(&count);
- if (count == 0)
- return NULL;
- return polys;
- }
- float* recast_getfixposition(int id, const float* pos)
- {
- if (!_helper || !_helper->Get(id)) return NULL;
- float* fixPos = _helper->Get(id)->fixPosition(pos);
- return fixPos;
- }
- }
|