mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-30 08:00:51 +00:00
more accurate expects and don't recurse for non-crossings
This commit is contained in:
parent
3d79256653
commit
0ee9e1cf3e
2 changed files with 23 additions and 23 deletions
|
@ -67,8 +67,8 @@ int main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
vec3_t start, end;
|
vec3_t start, end;
|
||||||
/*
|
|
||||||
puts ("\nexpect <=0.5, 1 (0 0 1 0), (0 0 1 0)");
|
puts ("\nexpect 0.496094, 1 (0 0 1 0), (0 0 1 0)");
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
start[0] = 0;
|
start[0] = 0;
|
||||||
start[1] = 47 + i;
|
start[1] = 47 + i;
|
||||||
|
@ -78,7 +78,7 @@ int main (int argc, char **argv)
|
||||||
do_trace (start, end);
|
do_trace (start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
puts ("\nexpect <=0.5, 1 (0 0 1 0), (0 0 1 0)");
|
puts ("\nexpect 0.496094, 1 (0 0 1 0), (0 0 1 0)");
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
start[0] = 0;
|
start[0] = 0;
|
||||||
start[1] = 52;
|
start[1] = 52;
|
||||||
|
@ -87,8 +87,8 @@ int main (int argc, char **argv)
|
||||||
end[1] -= 8;
|
end[1] -= 8;
|
||||||
do_trace (start, end);
|
do_trace (start, end);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
puts ("\nexpect <=0.5, 1 (0 0 1 0), (1 1 0 0)");
|
puts ("\nexpect 0.484375, 1 (0 0 1 0), (1 1 0 0)");
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
start[0] = 47 + i;
|
start[0] = 47 + i;
|
||||||
start[1] = -80;
|
start[1] = -80;
|
||||||
|
@ -98,7 +98,7 @@ int main (int argc, char **argv)
|
||||||
do_trace (start, end);
|
do_trace (start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
puts ("\nexpect <=0.5, 1 (0 0 1 0), (0 0 1 0)");
|
puts ("\nexpect 0.496094, 1 (0 0 1 0), (0 0 1 0)");
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
start[0] = 44;
|
start[0] = 44;
|
||||||
start[1] = -80;
|
start[1] = -80;
|
||||||
|
@ -108,7 +108,7 @@ int main (int argc, char **argv)
|
||||||
do_trace (start, end);
|
do_trace (start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
puts ("\nexpect 1, <=0.5 (0 1 1 0), (0 1 1 0)");
|
puts ("\nexpect 1, 0.499023 (0 1 1 0), (0 1 1 0)");
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
start[0] = 47 + i;
|
start[0] = 47 + i;
|
||||||
start[1] = -80;
|
start[1] = -80;
|
||||||
|
|
|
@ -134,6 +134,22 @@ traceline (int num, float p1f, float p2f, const vec3_t p1, const vec3_t p2,
|
||||||
vec3_t mid;
|
vec3_t mid;
|
||||||
mplane_t *op;
|
mplane_t *op;
|
||||||
|
|
||||||
|
while (num >= 0) {
|
||||||
|
node = tl->hull.clipnodes + num;
|
||||||
|
plane = tl->hull.planes + node->planenum;
|
||||||
|
|
||||||
|
t1 = PlaneDiff (p1, plane);
|
||||||
|
t2 = PlaneDiff (p2, plane);
|
||||||
|
offset = calc_offset (&tl->trace, plane);
|
||||||
|
|
||||||
|
if (t1 >= offset && t2 >= offset) {
|
||||||
|
num = node->children[0];
|
||||||
|
} if (t1 < -offset && t2 < -offset) {
|
||||||
|
num = node->children[1];
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (num < 0) {
|
if (num < 0) {
|
||||||
check_contents (num, &tl->trace);
|
check_contents (num, &tl->trace);
|
||||||
t1 = t2 = -3.14;
|
t1 = t2 = -3.14;
|
||||||
|
@ -156,22 +172,6 @@ traceline (int num, float p1f, float p2f, const vec3_t p1, const vec3_t p2,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
node = tl->hull.clipnodes + num;
|
|
||||||
plane = tl->hull.planes + node->planenum;
|
|
||||||
|
|
||||||
t1 = PlaneDiff (p1, plane);
|
|
||||||
t2 = PlaneDiff (p2, plane);
|
|
||||||
offset = calc_offset (&tl->trace, plane);
|
|
||||||
|
|
||||||
if (t1 >= offset && t2 >= offset) {
|
|
||||||
traceline (node->children[0], p1f, p2f, p1, p2, tl);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (t1 < -offset && t2 < -offset) {
|
|
||||||
traceline (node->children[1], p1f, p2f, p1, p2, tl);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (t1 < t2) {
|
if (t1 < t2) {
|
||||||
side = 1;
|
side = 1;
|
||||||
frac = (t1 - offset) / (t1 - t2);
|
frac = (t1 - offset) / (t1 - t2);
|
||||||
|
|
Loading…
Reference in a new issue