MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / CheckStaticCollideCamera

Function CheckStaticCollideCamera

TombEngine/Game/camera.cpp:1459–1483  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1457}
1458
1459bool CheckStaticCollideCamera(StaticMesh* mesh)
1460{
1461 bool isCloseEnough = Vector3i::Distance(mesh->Pose.Position, Camera.pos.ToVector3i()) <= COLL_CHECK_THRESHOLD;
1462 if (!isCloseEnough)
1463 return false;
1464
1465 if (!(mesh->Flags & StaticMeshFlags::SM_VISIBLE))
1466 return false;
1467
1468 const auto& bounds = GetBoundsAccurate(*mesh, false);
1469 auto extents = Vector3(
1470 abs(bounds.X1 - bounds.X2),
1471 abs(bounds.Y1 - bounds.Y2),
1472 abs(bounds.Z1 - bounds.Z2));
1473
1474 // Check extents; if any two bounds are smaller than threshold, discard.
1475 if ((abs(extents.x) < COLL_DISCARD_THRESHOLD && abs(extents.y) < COLL_DISCARD_THRESHOLD) ||
1476 (abs(extents.x) < COLL_DISCARD_THRESHOLD && abs(extents.z) < COLL_DISCARD_THRESHOLD) ||
1477 (abs(extents.y) < COLL_DISCARD_THRESHOLD && abs(extents.z) < COLL_DISCARD_THRESHOLD))
1478 {
1479 return false;
1480 }
1481
1482 return true;
1483}
1484
1485std::vector<StaticMesh*> FillCollideableStaticsList()
1486{

Callers 1

Calls 2

Vector3Function · 0.50
ToVector3iMethod · 0.45

Tested by

no test coverage detected