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

Function xSweptSpherePrepare

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

Source from the content-addressed store, hash-verified

1255 if (sws->dist < 0.0001f)
1256 {
1257 sws->dist = 0.0f;
1258 sws->curdist = 0.0f;
1259 return;
1260 }
1261
1262 F32 invmag = 1.0f / sws->dist;
1263 sws->basis.xm.at.x = dx * invmag;
1264 sws->basis.xm.at.y = dy * invmag;
1265 sws->basis.xm.at.z = dz * invmag;
1266
1267 if (xabs(dz) > xabs(dx) && xabs(dz) > xabs(dy))
1268 {
1269 sws->basis.xm.up.x = 0.0f;
1270 sws->basis.xm.up.y = dz;
1271 sws->basis.xm.up.z = -dy;
1272 }
1273 else
1274 {
1275 sws->basis.xm.up.x = -dy;
1276 sws->basis.xm.up.y = dx;
1277 sws->basis.xm.up.z = 0.0f;
1278 }
1279 sws->basis.xm.up.normalize();
1280
1281 xVec3Cross(&sws->basis.xm.right, &sws->basis.xm.up, &sws->basis.xm.at);
1282
1283 sws->basis.xm.pos.x = start->x;
1284 sws->basis.xm.pos.y = start->y;
1285 sws->basis.xm.pos.z = start->z;
1286
1287 xMat4x3OrthoInv(&sws->invbasis.xm, &sws->basis.xm);
1288
1289 sws->curdist = sws->dist;
1290 sws->optr = NULL;
1291 sws->mptr = NULL;
1292
1293 xCapsule tmpC;
1294 tmpC.start = *start;
1295 tmpC.end = *end;
1296 tmpC.r = radius;
1297 xBoxInitBoundCapsule(&sws->box, &tmpC);
1298
1299 xQuickCullForBox(&sws->qcd, &sws->box);
1300
1301 sws->boxsize = MAX(sws->box.upper.x - sws->box.lower.x, sws->box.upper.y - sws->box.lower.y);
1302 sws->boxsize = MAX(sws->box.upper.z - sws->box.lower.z, sws->boxsize);
1303}
1304
1305void xSweptSphereGetResults(xSweptSphere* sws)
1306{
1307 F32 tandot;
1308 xVec3 tanplane;
1309
1310 sws->hitIt = 0;
1311
1312 if (!sws->dist)
1313 return;
1314 if (sws->curdist == sws->dist)

Callers 3

_xCameraUpdateFunction · 0.70
DoWallJumpCheckFunction · 0.50
hit_testMethod · 0.50

Calls 5

xsqrtFunction · 0.85
xVec3CrossFunction · 0.85
xMat4x3OrthoInvFunction · 0.85
xBoxInitBoundCapsuleFunction · 0.85
xQuickCullForBoxFunction · 0.70

Tested by

no test coverage detected