| 769 | } |
| 770 | |
| 771 | S32 iSphereHitsModel3(const xSphere* b, const xModelInstance* m, xCollis* colls, U8 ncolls, F32 sth) |
| 772 | { |
| 773 | RpIntersection isx; |
| 774 | if (m->Flags & 0x800) |
| 775 | { |
| 776 | xModelAnimCollApply(*m); |
| 777 | } |
| 778 | |
| 779 | U8 idx; |
| 780 | U8 i; |
| 781 | for (idx = 0; idx < ncolls; idx++) |
| 782 | { |
| 783 | if (colls[idx].flags & 0x2000) |
| 784 | { |
| 785 | colls[idx].flags |= 0x400; |
| 786 | } |
| 787 | } |
| 788 | |
| 789 | isx.type = rpINTERSECTSPHERE; |
| 790 | memcpy(&isx.t.sphere, b, sizeof(xSphere)); |
| 791 | |
| 792 | xMat4x3* mat = (xMat4x3*)m->Mat; |
| 793 | RwFrameTransform((RwFrame*)m->Data->object.object.parent, (RwMatrix*)mat, rwCOMBINEREPLACE); |
| 794 | F32 mscale = xVec3Length(&mat->right); |
| 795 | xMat3x3 mnormal; |
| 796 | xMat3x3Normalize(&mnormal, mat); |
| 797 | xMat4x3Tolocal((xVec3*)&cbisx_local.t.sphere.center, mat, &b->center); |
| 798 | |
| 799 | cbisx_local.t.sphere.radius = b->r / mscale; |
| 800 | |
| 801 | for (i = 0; i < ncolls; i++) |
| 802 | { |
| 803 | colls[i].flags &= ~1; |
| 804 | colls[i].dist = FLOAT_MAX; |
| 805 | } |
| 806 | |
| 807 | cbath = sth; |
| 808 | cbnumcs = 0; |
| 809 | cbmaxcs = ncolls; |
| 810 | OTHER = 0xff; |
| 811 | NEXT2 = 0xff; |
| 812 | FLOOR = 0xff; |
| 813 | |
| 814 | iTime t0 = iTimeGet(); |
| 815 | RpAtomicForAllIntersections(m->Data, &isx, sphereHitsModel3CB, colls); |
| 816 | iTime t1 = iTimeGet(); |
| 817 | |
| 818 | collide_rwtime += t1 - t0; |
| 819 | collide_rwct += 1; |
| 820 | collide_rwtime_secs = iTimeDiffSec(collide_rwtime) / collide_rwct; |
| 821 | |
| 822 | if (colls->flags & 0x1F00) |
| 823 | { |
| 824 | for (i = 0; i < cbnumcs; i++) |
| 825 | { |
| 826 | if ((colls[i].flags & 1) == 0) |
| 827 | { |
| 828 | continue; |
no test coverage detected