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

Function xSweptSphereToEnv

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

Source from the content-addressed store, hash-verified

1955 line.end = *(RwV3d*)&sws->end;
1956
1957 RwV3d delta;
1958 RwV3dSubMacro(&delta, &line.end, &line.start);
1959
1960 xClumpCollV3dGradient grad;
1961 F32 recip;
1962
1963 recip = (delta.x != 0.0f) ? (1.0f / delta.x) : 0.0f;
1964 grad.dydx = delta.y * recip;
1965 grad.dzdx = delta.z * recip;
1966
1967 recip = (delta.y != 0.0f) ? (1.0f / delta.y) : 0.0f;
1968 grad.dxdy = delta.x * recip;
1969 grad.dzdy = delta.z * recip;
1970
1971 recip = (delta.z != 0.0f) ? (1.0f / delta.z) : 0.0f;
1972 grad.dxdz = delta.x * recip;
1973 grad.dydz = delta.y * recip;
1974
1975 xClumpColl_ForAllCapsuleLeafNodeIntersections(env->geom->jsp->colltree, &line, sws->radius,
1976 &grad, SweptSphereLeafNodeCB, sws);
1977 }
1978 else
1979 {
1980 RpIntersection isx;
1981 isx.type = rpINTERSECTBOX;
1982 isx.t.box.sup = *(RwV3d*)&sws->box.upper;
1983 isx.t.box.inf = *(RwV3d*)&sws->box.lower;
1984
1985 RpCollisionWorldForAllIntersections(env->geom->world, &isx, SweptSphereHitsEnvCB, sws);
1986 }
1987
1988 return sSweptSphereHitFound;
1989}
1990
1991static S32 SweptSphereModelCB(S32 numTriangles, S32 triOffset, void* data)
1992{
1993 SweptSphereCollParam* isData = (SweptSphereCollParam*)data;
1994 RpGeometry* geometry = isData->geometry;
1995 xSweptSphere* sws = isData->sws;
1996 RwV3d* vertices = geometry->morphTarget->verts;
1997 RpTriangle* triangles = geometry->triangles;
1998 S32 triSlot = triOffset;
1999 U16* triIndex = RpCollisionGeometryGetData(geometry)->triangleMap + triOffset;
2000
2001 while (numTriangles--)
2002 {
2003 triSlot = *triIndex++;
2004 RpTriangle* tri = &triangles[triSlot];
2005 S32 vertIndex0 = tri->vertIndex[0];

Callers 3

_xCameraUpdateFunction · 0.70
xSweptSphereToSceneFunction · 0.70
xSweptSphereToNonMovingFunction · 0.70

Tested by

no test coverage detected