MCPcopy Create free account
hub / github.com/axmolengine/axmol / classifyOffMeshPoint

Function classifyOffMeshPoint

3rdparty/recast/DetourNavMeshBuilder.cpp:243–269  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

241}
242
243static unsigned char classifyOffMeshPoint(const float* pt, const float* bmin, const float* bmax)
244{
245 static const unsigned char XP = 1<<0;
246 static const unsigned char ZP = 1<<1;
247 static const unsigned char XM = 1<<2;
248 static const unsigned char ZM = 1<<3;
249
250 unsigned char outcode = 0;
251 outcode |= (pt[0] >= bmax[0]) ? XP : 0;
252 outcode |= (pt[2] >= bmax[2]) ? ZP : 0;
253 outcode |= (pt[0] < bmin[0]) ? XM : 0;
254 outcode |= (pt[2] < bmin[2]) ? ZM : 0;
255
256 switch (outcode)
257 {
258 case XP: return 0;
259 case XP|ZP: return 1;
260 case ZP: return 2;
261 case XM|ZP: return 3;
262 case XM: return 4;
263 case XM|ZM: return 5;
264 case ZM: return 6;
265 case XP|ZM: return 7;
266 };
267
268 return 0xff;
269}
270
271// TODO: Better error handling.
272

Callers 1

dtCreateNavMeshDataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected