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

Function xClumpColl_ForAllBoxLeafNodeIntersections

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

Source from the content-addressed store, hash-verified

72}
73
74xClumpCollBSPTree*
75xClumpColl_ForAllBoxLeafNodeIntersections(xClumpCollBSPTree* tree, RwBBox* box,
76 xClumpCollIntersectionCallback callBack, void* data)
77{
78 S32 nStack;
79 nodeInfo nodeStack[33];
80 nodeInfo node;
81
82 node.type = tree->branchNodes ? 2 : 1;
83 node.index = 0;
84 nStack = 0;
85
86 while (nStack >= 0)
87 {
88 if (node.type == 1)
89 {
90 xClumpCollBSPTriangle* tris = tree->triangles + node.index;
91 if (!callBack(tris, data))
92 return NULL;
93
94 node = nodeStack[nStack];
95 nStack--;
96 }
97 else
98 {
99 xClumpCollBSPBranchNode* branch = tree->branchNodes + node.index;
100
101 if (*((RwReal*)((U8*)&box->inf + (branch->leftInfo & 0xC))) < branch->leftValue)
102 {
103 node.type = branch->leftInfo & 0x3;
104 node.index = branch->leftInfo >> 12;
105
106 if (*(RwReal*)((U8*)&box->sup + (branch->leftInfo & 0xC)) >= branch->rightValue)
107 {
108 nStack++;
109 nodeStack[nStack].type = branch->rightInfo & 0x3;
110 nodeStack[nStack].index = branch->rightInfo >> 12;
111 }
112 }
113 else
114 {
115 node.type = branch->rightInfo & 0x3;
116 node.index = branch->rightInfo >> 12;
117 }
118 }
119 }
120
121 return tree;
122}
123
124xClumpCollBSPTree*
125xClumpColl_ForAllLineLeafNodeIntersections(xClumpCollBSPTree* tree, RwLine* line,

Callers 2

xParabolaHitsEnvFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected