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

Function xBoxHitsSphere

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

Source from the content-addressed store, hash-verified

611 coll->flags &= 0xfffffffe;
612 }
613 else
614 {
615 if (isx.contained <= 0.0f)
616 {
617 coll->flags |= 0x10;
618 }
619 coll->dist = isx.dist;
620 if (coll->flags & 0x0400)
621 {
622 xVec3Copy(&coll->tohit, &isx.norm);
623 }
624 if ((coll->flags & 0x800) != 0)
625 {
626 if (isx.dist == 0.0f)
627 {
628 xVec3Copy(&coll->depen, &g_O3);
629 }
630 else
631 {
632 xVec3SMul(&coll->depen, &isx.norm, isx.penned / isx.dist);
633 }
634 }
635 if ((coll->flags & 0x1200) != 0)
636 {
637 xVec3Normalize(&coll->hdng, &isx.norm);
638 }
639 if ((coll->flags & 0x200) != 0)
640 {
641 xVec3Inv(&coll->norm, &coll->hdng);
642 }
643 uVar1 = 1;
644 coll->flags |= 1;
645 }
646 return uVar1;
647}
648
649#define NORMALIZE(v, s) \
650 MACRO_START \
651 { \
652 F32 _mag = SQR((v)->x) + SQR((v)->y) + SQR((v)->z); \
653 if (xabs(_mag - 1.0f) > 0.000001f && _mag > 0.00001f) \
654 { \
655 _mag = xsqrt(_mag); \
656 *(s) *= _mag; \
657 _mag = 1.0f / _mag; \
658 (v)->x *= _mag; \
659 (v)->y *= _mag; \
660 (v)->z *= _mag; \
661 } \
662 } \
663 MACRO_STOP

Callers 1

xBoundHitsBoundFunction · 0.70

Calls 5

xVec3CopyFunction · 0.85
xVec3SMulFunction · 0.85
xVec3InvFunction · 0.85
xVec3NormalizeFunction · 0.70
iBoxIsectSphereFunction · 0.50

Tested by

no test coverage detected