(int num, float p1f, float p2f, float[] p1, float[] p2)
| 1288 | * ================== CM_RecursiveHullCheck ================== |
| 1289 | */ |
| 1290 | public void CM_RecursiveHullCheck(int num, float p1f, float p2f, float[] p1, float[] p2) { |
| 1291 | cnode_t node; |
| 1292 | cplane_t plane; |
| 1293 | float t1, t2, offset; |
| 1294 | float frac, frac2; |
| 1295 | float idist; |
| 1296 | int i; |
| 1297 | int side; |
| 1298 | float midf; |
| 1299 | |
| 1300 | if (trace_trace.fraction <= p1f) |
| 1301 | return; // already hit something nearer |
| 1302 | |
| 1303 | // if < 0, we are in a leaf node |
| 1304 | if (num < 0) { |
| 1305 | CM_TraceToLeaf(-1 - num); |
| 1306 | return; |
| 1307 | } |
| 1308 | |
| 1309 | // |
| 1310 | // find the point distances to the seperating plane |
| 1311 | // and the offset for the size of the box |
| 1312 | // |
| 1313 | node = map_nodes[num]; |
| 1314 | plane = node.plane; |
| 1315 | |
| 1316 | if (plane.type < 3) { |
| 1317 | t1 = p1[plane.type] - plane.dist; |
| 1318 | t2 = p2[plane.type] - plane.dist; |
| 1319 | offset = trace_extents[plane.type]; |
| 1320 | } else { |
| 1321 | t1 = Math3D.DotProduct(plane.normal, p1) - plane.dist; |
| 1322 | t2 = Math3D.DotProduct(plane.normal, p2) - plane.dist; |
| 1323 | if (trace_ispoint) |
| 1324 | offset = 0; |
| 1325 | else |
| 1326 | offset = Math.abs(trace_extents[0] * plane.normal[0]) |
| 1327 | + Math.abs(trace_extents[1] * plane.normal[1]) |
| 1328 | + Math.abs(trace_extents[2] * plane.normal[2]); |
| 1329 | } |
| 1330 | |
| 1331 | // see which sides we need to consider |
| 1332 | if (t1 >= offset && t2 >= offset) { |
| 1333 | CM_RecursiveHullCheck(node.children[0], p1f, p2f, p1, p2); |
| 1334 | return; |
| 1335 | } |
| 1336 | if (t1 < -offset && t2 < -offset) { |
| 1337 | CM_RecursiveHullCheck(node.children[1], p1f, p2f, p1, p2); |
| 1338 | return; |
| 1339 | } |
| 1340 | |
| 1341 | // put the crosspoint DIST_EPSILON pixels on the near side |
| 1342 | if (t1 < t2) { |
| 1343 | idist = 1.0f / (t1 - t2); |
| 1344 | side = 1; |
| 1345 | frac2 = (t1 + offset + DIST_EPSILON) * idist; |
| 1346 | frac = (t1 - offset + DIST_EPSILON) * idist; |
| 1347 | } else if (t1 > t2) { |
no test coverage detected