| 241 | } |
| 242 | |
| 243 | static 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 |
no outgoing calls
no test coverage detected