remove pseudoangle as its slower
This commit is contained in:
1 parent
07f8a532f9
commit
cef3c7f032
3 files changed
+31
-41
No files matched your search
+31
-6
@@ -2591,8 +2591,16 @@ void HWR_AddLine(seg_t *line)
|
||||
}
|
||||
|
||||
// OPTIMIZE: quickly reject orthogonal back sides.
|
||||
angle1 = R_PointToPseudoAngle(v1x, v1y);
|
||||
angle2 = R_PointToPseudoAngle(v2x, v2y);
|
||||
if (cv_pointoangleexor64.value)
|
||||
{
|
||||
angle1 = R_PointToAngle64(v1x, v1y);
|
||||
angle2 = R_PointToAngle64(v2x, v2y);
|
||||
}
|
||||
else
|
||||
{
|
||||
angle1 = R_PointToAngleEx(viewx, viewy, v1x, v1y);
|
||||
angle2 = R_PointToAngleEx(viewx, viewy, v2x, v2y);
|
||||
}
|
||||
|
||||
// PrBoom: Back side, i.e. backface culling - read: endAngle >= startAngle!
|
||||
if (angle2 - angle1 < ANGLE_180)
|
||||
@@ -2787,8 +2795,17 @@ boolean HWR_CheckBBox(fixed_t *bspcoord)
|
||||
if (mindist > current_bsp_culling_distance) return false;
|
||||
}
|
||||
|
||||
angle1 = R_PointToPseudoAngle(px1, py1);
|
||||
angle2 = R_PointToPseudoAngle(px2, py2);
|
||||
if (cv_pointoangleexor64.value)
|
||||
{
|
||||
angle1 = R_PointToAngle64(px1, py1);
|
||||
angle2 = R_PointToAngle64(px2, py2);
|
||||
}
|
||||
else
|
||||
{
|
||||
angle1 = R_PointToAngleEx(viewx, viewy, px1, py1);
|
||||
angle2 = R_PointToAngleEx(viewx, viewy, px2, py2);
|
||||
}
|
||||
|
||||
return gld_clipper_SafeCheckRange(angle2, angle1);
|
||||
}
|
||||
|
||||
@@ -5551,8 +5568,16 @@ static void HWR_PortalClipping(gl_portal_t *portal)
|
||||
|
||||
line_t *line = &lines[portal->clipline];
|
||||
|
||||
angle1 = R_PointToPseudoAngle(line->v1->x, line->v1->y);
|
||||
angle2 = R_PointToPseudoAngle(line->v2->x, line->v2->y);
|
||||
if (cv_pointoangleexor64.value)
|
||||
{
|
||||
angle1 = R_PointToAngle64(line->v1->x, line->v1->y);
|
||||
angle2 = R_PointToAngle64(line->v2->x, line->v2->y);
|
||||
}
|
||||
else
|
||||
{
|
||||
angle1 = R_PointToAngleEx(viewx, viewy, line->v1->x, line->v1->y);
|
||||
angle2 = R_PointToAngleEx(viewx, viewy, line->v2->x, line->v2->y);
|
||||
}
|
||||
|
||||
// clip things that are not inside the portal window from our viewpoint
|
||||
gld_clipper_SafeAddClipRange(angle2, angle1);
|
||||
|
||||
@@ -457,40 +457,6 @@ angle_t R_PointToAngle2(fixed_t pviewx, fixed_t pviewy, fixed_t x, fixed_t y)
|
||||
0;
|
||||
}
|
||||
|
||||
//
|
||||
// R_PointToPseudoAngle
|
||||
// ! Returns the pseudoangle between the line p1 to (infinity, p1.y) and the
|
||||
// line from p1 to p2. The pseudoangle has the property that the ordering of
|
||||
// points by true angle anround p1 and ordering of points by pseudoangle are the
|
||||
// same.
|
||||
//
|
||||
// For clipping exact angles are not needed. Only the ordering matters.
|
||||
// This is about as fast as the fixed point R_PointToAngle2 but without
|
||||
// the precision issues associated with that function.
|
||||
//
|
||||
|
||||
angle_t R_PointToPseudoAngle (fixed_t x, fixed_t y)
|
||||
{
|
||||
// Note: float won't work here as it's less precise than the BAM values being passed as parameters
|
||||
double vecx = (double)x - viewx;
|
||||
double vecy = (double)y - viewy;
|
||||
double epsilon = 1e-9;
|
||||
|
||||
if (fabs(vecx) < epsilon && fabs(vecy) < epsilon)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
double result = vecy / (fabs(vecx) + fabs(vecy));
|
||||
if (vecx < 0)
|
||||
{
|
||||
result = 2.0 - result;
|
||||
}
|
||||
return (angle_t)xs_CRoundToInt(result * (1 << 30));
|
||||
}
|
||||
}
|
||||
|
||||
fixed_t R_PointToDist2(fixed_t px2, fixed_t py2, fixed_t px1, fixed_t py1)
|
||||
{
|
||||
return FixedHypot(px1 - px2, py1 - py2);
|
||||
|
||||
@@ -71,7 +71,6 @@ angle_t R_PointToAngle(fixed_t x, fixed_t y);
|
||||
angle_t R_PointToAngle64(INT64 x, INT64 y);
|
||||
angle_t R_PointToAngleEx(INT32 x2, INT32 y2, INT32 x1, INT32 y1);
|
||||
angle_t R_PointToAngle2(fixed_t px2, fixed_t py2, fixed_t px1, fixed_t py1);
|
||||
angle_t R_PointToPseudoAngle (fixed_t x, fixed_t y);
|
||||
fixed_t R_PointToDist(fixed_t x, fixed_t y);
|
||||
fixed_t R_PointToDist2(fixed_t px2, fixed_t py2, fixed_t px1, fixed_t py1);
|
||||
angle_t R_PlayerSliptideAngle(player_t *player);
|
||||
|
||||
Reference in new issue
Block a user