MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / xOBBHitsOBB

Function xOBBHitsOBB

src/SB/Core/x/xCollide.cpp:2373–2493  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2371 xmat.right.y = amat.right.dot(bmat.up);
2372 xmat.right.z = amat.right.dot(bmat.at);
2373 xmat.up.x = amat.up.dot(bmat.right);
2374 xmat.up.y = amat.up.dot(bmat.up);
2375 xmat.up.z = amat.up.dot(bmat.at);
2376 xmat.at.x = amat.at.dot(bmat.right);
2377 xmat.at.y = amat.at.dot(bmat.up);
2378 xmat.at.z = amat.at.dot(bmat.at);
2379
2380 xMat3x3 axmat;
2381 axmat.right = xmat.right.get_abs();
2382 axmat.up = xmat.up.get_abs();
2383 axmat.at = xmat.at.get_abs();
2384
2385 F32 ar, br, r;
2386
2387 br = b.upper.x * axmat.right.x + b.upper.y * axmat.right.y + b.upper.z * axmat.right.z;
2388 ar = a.upper.x + br;
2389 if (xabs(aoffset.x) > ar)
2390 return false;
2391
2392 br = b.upper.x * axmat.up.x + b.upper.y * axmat.up.y + b.upper.z * axmat.up.z;
2393 ar = a.upper.y + br;
2394 if (xabs(aoffset.y) > ar)
2395 return false;
2396
2397 br = b.upper.x * axmat.at.x + b.upper.y * axmat.at.y + b.upper.z * axmat.at.z;
2398 ar = a.upper.z + br;
2399 if (xabs(aoffset.z) > ar)
2400 return false;
2401
2402 r = bmat.right.dot(offset);
2403 ar = a.upper.x * axmat.right.x + a.upper.y * axmat.up.x + a.upper.z * axmat.at.x;
2404 br = ar + b.upper.x;
2405 if (xabs(r) > br)
2406 return false;
2407
2408 r = bmat.up.dot(offset);
2409 ar = a.upper.x * axmat.right.y + a.upper.y * axmat.up.y + a.upper.z * axmat.at.y;
2410 br = ar + b.upper.y;
2411 if (xabs(r) > br)
2412 return false;
2413
2414 r = bmat.at.dot(offset);
2415 ar = a.upper.x * axmat.right.z + a.upper.y * axmat.up.z + a.upper.z * axmat.at.z;
2416 br = ar + b.upper.z;
2417 if (xabs(r) > br)
2418 return false;
2419
2420 if (axmat.right.x > 0.999f || axmat.right.y > 0.999f || axmat.right.z > 0.999f ||
2421 axmat.up.x > 0.999f || axmat.up.y > 0.999f || axmat.up.z > 0.999f || axmat.at.x > 0.999f ||
2422 axmat.at.y > 0.999f || axmat.at.z > 0.999f)
2423 return true;
2424
2425 r = aoffset.z * xmat.up.x - aoffset.y * xmat.at.x;
2426 ar = a.upper.y * axmat.at.x + a.upper.z * axmat.up.x;
2427 br = b.upper.y * axmat.right.z + b.upper.z * axmat.right.y + ar;
2428 if (xabs(r) > br)
2429 return false;
2430

Callers

nothing calls this directly

Calls 2

get_absMethod · 0.80
dotMethod · 0.45

Tested by

no test coverage detected