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

Function SkinXform

src/SB/Core/gc/iModel.cpp:437–497  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

435 {
436 return 1;
437 }
438
439 return (RwCameraFrustumTestSphere(cam, &sph) == rwSPHEREOUTSIDE);
440}
441
442S32 iModelSphereCull(xSphere* sphere)
443{
444 RwCamera* camera = RwCameraGetCurrentCamera();
445 RwFrustumTestResult result = RwCameraFrustumTestSphere(camera, (RwSphere*)sphere);
446 return (result == rwSPHEREOUTSIDE);
447}
448
449S32 iModelCullPlusShadow(RpAtomic* model, RwMatrix* mat, xVec3* shadowVec, S32* shadowOutside)
450{
451 F32 xScale2, yScale2, zScale2;
452 RwV3d *right, *up, *at;
453 RwCamera* cam;
454 RwSphere worldsph;
455 const RwFrustumPlane* frustumPlane;
456 S32 numPlanes;
457
458 cam = RwCameraGetCurrentCamera();
459
460 RwV3dTransformPoints(&worldsph.center, &model->boundingSphere.center, 1, mat);
461
462 right = &mat->right;
463 up = &mat->up;
464 at = &mat->at;
465 xScale2 = SQR(right->x) + SQR(right->y) + SQR(right->z);
466 yScale2 = SQR(up->x) + SQR(up->y) + SQR(up->z);
467 zScale2 = SQR(at->x) + SQR(at->y) + SQR(at->z);
468 worldsph.radius = model->boundingSphere.radius * xsqrt(MAX3(xScale2, yScale2, zScale2));
469 model->worldBoundingSphere = worldsph;
470
471 numPlanes = 6;
472 frustumPlane = cam->frustumPlanes;
473 while (numPlanes--)
474 {
475 F32 nDot = worldsph.center.x * frustumPlane->plane.normal.x +
476 worldsph.center.y * frustumPlane->plane.normal.y +
477 worldsph.center.z * frustumPlane->plane.normal.z;
478 nDot -= frustumPlane->plane.distance;
479
480 if (nDot > worldsph.radius)
481 {
482 F32 nDot;
483
484 F32 sDot = shadowVec->x * frustumPlane->plane.normal.x +
485 shadowVec->y * frustumPlane->plane.normal.y +
486 shadowVec->z * frustumPlane->plane.normal.z;
487 sDot -= frustumPlane->plane.distance;
488
489 if (sDot > worldsph.radius)
490 {
491 *shadowOutside = 1;
492 return 1;
493 }
494

Callers 1

iModelTagEvalFunction · 0.85

Calls 1

xMat4x3MulFunction · 0.85

Tested by

no test coverage detected