| 960 | } |
| 961 | |
| 962 | const RpTriangle& t = RpGeometryGetTriangles(geom)[tri.index]; |
| 963 | for (S32 i = 0; i < 3; i++) |
| 964 | { |
| 965 | v[i] = verts[t.vertIndex[i]]; |
| 966 | xMat4x3Toworld(&v[i], &m, &v[i]); |
| 967 | } |
| 968 | |
| 969 | xVec3 r[2]; |
| 970 | xVec3 d, A, B, C, AxB, CxB; |
| 971 | |
| 972 | r[0] = v[0] + (v[1] - v[0]) * tri.r; |
| 973 | r[1] = v[0] + (v[2] - v[0]) * tri.r; |
| 974 | d = r[0] + (r[1] - r[0]) * tri.d; |
| 975 | A = d - v[0]; |
| 976 | B = r[1] - r[0]; |
| 977 | C = r[0] - v[0]; |
| 978 | AxB = A.cross(B); |
| 979 | CxB = C.cross(B); |
| 980 | |
| 981 | F32 len2 = AxB.length2(); |
| 982 | xVec3 hit = (xfeq0(len2)) ? v[0] : v[0] + A * (CxB.dot(AxB) / len2); |
| 983 | |
| 984 | return hit; |
| 985 | } |
| 986 | |
| 987 | RpCollBSPTree* _rpCollBSPTreeForAllCapsuleLeafNodeIntersections( |
| 988 | RpCollBSPTree* tree, RwLine* line, RwReal radius, RpV3dGradient* grad, |
| 989 | RwBool (*callBack)(RwInt32, RwInt32, void*), void* data) |
| 990 | { |
| 991 | RwInt32 nStack; |
| 992 | nodeInfo nodeStack[33]; |
| 993 | nodeInfo currNode; |
| 994 | RwLine lineStack[33]; |
| 995 | RwLine currLine; |
| 996 | |
| 997 | currNode.type = (tree->branchNodes ? 1 : 0) + 1; |
| 998 | currNode.index = 0; |
| 999 | currLine = *line; |
| 1000 | nStack = 0; |
| 1001 |
no test coverage detected