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

Function xClumpColl_ForAllIntersections

src/SB/Core/x/xClumpColl.cpp:808–890  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

806}
807
808xClumpCollBSPTree* xClumpColl_ForAllIntersections(xClumpCollBSPTree* tree,
809 RpIntersection* intersection,
810 RpIntersectionCallBackWorldTriangle callBack,
811 void* data)
812{
813 CallBackParam cbParam;
814 cbParam.intersection = intersection;
815 cbParam.u.worldCB = callBack;
816 cbParam.data = data;
817
818 switch (intersection->type)
819 {
820 case rpINTERSECTPOINT:
821 return NULL;
822 case rpINTERSECTLINE:
823 {
824 PolyLineTestParam isData;
825 RwLine* line = &intersection->t.line;
826 F32 recip;
827
828 isData.start = line->start;
829 RwV3dSubMacro(&isData.delta, &line->end, &line->start);
830 isData.cbParam = &cbParam;
831 isData.line = *line;
832
833 recip = (isData.delta.x != 0.0f) ? (1.0f / isData.delta.x) : 0.0f;
834 isData.grad.dydx = isData.delta.y * recip;
835 isData.grad.dzdx = isData.delta.z * recip;
836
837 recip = (isData.delta.y != 0.0f) ? (1.0f / isData.delta.y) : 0.0f;
838 isData.grad.dxdy = isData.delta.x * recip;
839 isData.grad.dzdy = isData.delta.z * recip;
840
841 recip = (isData.delta.z != 0.0f) ? (1.0f / isData.delta.z) : 0.0f;
842 isData.grad.dxdz = isData.delta.x * recip;
843 isData.grad.dydz = isData.delta.y * recip;
844
845 xClumpColl_ForAllLineLeafNodeIntersections(tree, line, &isData.grad,
846 LeafNodeLinePolyIntersect, &isData);
847
848 return tree;
849 }
850 case rpINTERSECTSPHERE:
851 {
852 PolyTestParam isData;
853 TestSphere testSphere;
854
855 isData.bbox.inf = isData.bbox.sup = intersection->t.sphere.center;
856 isData.bbox.inf.x -= intersection->t.sphere.radius;
857 isData.bbox.inf.y -= intersection->t.sphere.radius;
858 isData.bbox.inf.z -= intersection->t.sphere.radius;
859 isData.bbox.sup.x += intersection->t.sphere.radius;
860 isData.bbox.sup.y += intersection->t.sphere.radius;
861 isData.bbox.sup.z += intersection->t.sphere.radius;
862
863 testSphere.sphere = &intersection->t.sphere;
864
865 isData.leafTestData = &testSphere;

Callers 5

xSceneNearestFloorPolyFunction · 0.70
iSphereHitsEnvFunction · 0.50
iSphereHitsEnv3Function · 0.50
iSphereHitsEnv4Function · 0.50
iRayHitsEnvFunction · 0.50

Tested by

no test coverage detected