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

Function SweptSphereHitsCameraEnt

src/SB/Core/x/xCamera.cpp:372–470  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

370}
371
372void SweptSphereHitsCameraEnt(xScene*, xRay3* ray, xQCData* qcd, xEnt* ent, void* data)
373{
374 xSweptSphere* sws = (xSweptSphere*)data;
375
376 if (ent->camcollModel && ent->chkby & 0x10 && xQuickCullIsects(qcd, &ent->bound.qcd))
377 {
378 if (!xEntIsVisible(ent))
379 {
380 if (ent->model->Data != sInvisWallHack)
381 {
382 return;
383 }
384
385 if (ent->collLev != 5)
386 {
387 if (ent->bound.type == XBOUND_TYPE_BOX)
388 {
389 xSweptSphereToBox(sws, &ent->bound.box.box, NULL);
390 return;
391 }
392 else if (ent->bound.type == XBOUND_TYPE_OBB)
393 {
394 xSweptSphereToBox(sws, &ent->bound.box.box, ent->bound.mat);
395 return;
396 }
397 else
398 {
399 return;
400 }
401 }
402 }
403
404 U32 result = 0;
405
406 switch (ent->bound.type)
407 {
408 case XBOUND_TYPE_SPHERE:
409 {
410 F32 oldrad = ent->bound.sph.r;
411
412 ent->bound.sph.r += sws->radius;
413
414 result = xRayHitsSphereFast(ray, &ent->bound.sph);
415
416 ent->bound.sph.r = oldrad;
417
418 break;
419 }
420 case XBOUND_TYPE_BOX:
421 {
422 xBox tmpbox;
423 tmpbox.upper.x = ent->bound.box.box.upper.x + sws->radius;
424 tmpbox.upper.y = ent->bound.box.box.upper.y + sws->radius;
425 tmpbox.upper.z = ent->bound.box.box.upper.z + sws->radius;
426 tmpbox.lower.x = ent->bound.box.box.lower.x - sws->radius;
427 tmpbox.lower.y = ent->bound.box.box.lower.y - sws->radius;
428 tmpbox.lower.z = ent->bound.box.box.lower.z - sws->radius;
429

Callers

nothing calls this directly

Calls 10

xEntIsVisibleFunction · 0.85
xVec3LengthFunction · 0.85
xMat3x3NormalizeFunction · 0.85
xMat4x3TolocalFunction · 0.85
xMat3x3TolocalFunction · 0.85
xQuickCullIsectsFunction · 0.70
xSweptSphereToBoxFunction · 0.70
xRayHitsSphereFastFunction · 0.70
xRayHitsBoxFastFunction · 0.70
xSweptSphereToModelFunction · 0.70

Tested by

no test coverage detected