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

Function xRayHitsSphereFast

src/SB/Core/x/xCollideFast.cpp:12–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10}
11
12U32 xRayHitsSphereFast(const xRay3* r, const xSphere* s)
13{
14 xVec3 length;
15 xVec3Sub(&length, &r->origin, &s->center);
16 F32 dVar3 = xVec3Dot(&length, &length) - SQR(s->r);
17 if (dVar3 <= 0.0f)
18 {
19 return 1;
20 }
21
22 if (r->flags & (1 << 11) && dVar3 > r->max_t * (2.0f * s->r + r->max_t))
23 {
24 return 0;
25 }
26
27 F32 dot = xVec3Dot(&length, &r->dir);
28 return (dot >= 0.0f) ? 0 : (SQR(dot) >= dVar3);
29}
30
31U32 xRayHitsBoxFast(const xRay3* r, const xBox* b)
32{

Callers 2

SweptSphereHitsCameraEntFunction · 0.70
SweptSphereHitsEntCBFunction · 0.70

Calls 1

xVec3SubFunction · 0.85

Tested by

no test coverage detected