Revert "port R_PointToPseudoAngle && gld_clipper_AngleToPseudo from dsda-doom"
This reverts commit 353589d13a.
This commit is contained in:
1 parent
353589d13a
commit
9e13a4b695
7 files changed
+34
-103
No files matched your search
@@ -190,29 +190,6 @@ void gld_clipper_SafeAddClipRange(angle_t startangle, angle_t endangle)
|
||||
}
|
||||
}
|
||||
|
||||
static angle_t gld_clipper_AngleToPseudo(angle_t ang)
|
||||
{
|
||||
const double angradians = ang * (M_PI / (double)ANGLE_180);
|
||||
double vecx = cos(angradians);
|
||||
double vecy = sin(angradians);
|
||||
|
||||
double result = vecy / (fabs(vecx) + fabs(vecy));
|
||||
|
||||
if (vecx < 0)
|
||||
{
|
||||
result = 2.0 - result;
|
||||
}
|
||||
|
||||
return (angle_t)xs_CRoundToUInt(result * (1<<30));
|
||||
}
|
||||
|
||||
void gld_clipper_SafeAddClipRangeRealAngles(angle_t startangle, angle_t endangle)
|
||||
{
|
||||
gld_clipper_SafeAddClipRange(
|
||||
gld_clipper_AngleToPseudo(startangle),
|
||||
gld_clipper_AngleToPseudo(endangle));
|
||||
}
|
||||
|
||||
static void gld_clipper_AddClipRange(angle_t start, angle_t end)
|
||||
{
|
||||
clipnode_t *node, *temp, *prevNode, *node2, *delnode;
|
||||
|
||||
@@ -20,7 +20,6 @@ extern "C" {
|
||||
|
||||
boolean gld_clipper_SafeCheckRange(angle_t startAngle, angle_t endAngle);
|
||||
void gld_clipper_SafeAddClipRange(angle_t startangle, angle_t endangle);
|
||||
void gld_clipper_SafeAddClipRangeRealAngles(angle_t startangle, angle_t endangle);
|
||||
void gld_clipper_Clear(void);
|
||||
angle_t gld_FrustumAngle(angle_t tiltangle);
|
||||
#ifdef HAVE_SPHEREFRUSTRUM
|
||||
|
||||
@@ -2473,8 +2473,8 @@ static void HWR_AddLine(seg_t *line)
|
||||
v2y = gl_curline->v2->y;
|
||||
|
||||
// OPTIMIZE: quickly reject orthogonal back sides.
|
||||
angle1 = R_PointToPseudoAngle(v1x, v1y);
|
||||
angle2 = R_PointToPseudoAngle(v2x, v2y);
|
||||
angle1 = R_PointToAngle64(v1x, v1y);
|
||||
angle2 = R_PointToAngle64(v2x, v2y);
|
||||
|
||||
// PrBoom: Back side, i.e. backface culling - read: endAngle >= startAngle!
|
||||
if (angle2 - angle1 < ANGLE_180)
|
||||
@@ -2586,8 +2586,8 @@ static boolean HWR_CheckBBox(const fixed_t *bspcoord)
|
||||
return false;
|
||||
}
|
||||
|
||||
angle1 = R_PointToPseudoAngle(px1, py1);
|
||||
angle2 = R_PointToPseudoAngle(px2, py2);
|
||||
angle1 = R_PointToAngle64(px1, py1);
|
||||
angle2 = R_PointToAngle64(px2, py2);
|
||||
|
||||
return gld_clipper_SafeCheckRange(angle2, angle1);
|
||||
}
|
||||
@@ -5511,7 +5511,7 @@ void HWR_ClearClipper(void)
|
||||
const angle_t a1 = gld_FrustumAngle(gl_aimingangle);
|
||||
|
||||
gld_clipper_Clear();
|
||||
gld_clipper_SafeAddClipRangeRealAngles(viewangle + a1, viewangle - a1);
|
||||
gld_clipper_SafeAddClipRange(viewangle + a1, viewangle - a1);
|
||||
#ifdef HAVE_SPHEREFRUSTRUM
|
||||
gld_FrustumSetup();
|
||||
#endif
|
||||
|
||||
@@ -265,6 +265,35 @@ FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedRound(fixed_t x)
|
||||
return INT32_MAX;
|
||||
}
|
||||
|
||||
/** \brief The xs_CRoundToInt function
|
||||
|
||||
\param val double number
|
||||
|
||||
\return Round toward nearest, but ties round toward even
|
||||
*/
|
||||
#if defined(SRB2_BIG_ENDIAN)
|
||||
#define _xs_iexp_ 0
|
||||
#define _xs_iman_ 1
|
||||
#else
|
||||
#define _xs_iexp_ 1 //intel is little endian
|
||||
#define _xs_iman_ 0
|
||||
#endif //BigEndian_
|
||||
|
||||
typedef double real64;
|
||||
|
||||
typedef union _xs_doubleints
|
||||
{
|
||||
real64 val;
|
||||
unsigned ival[2];
|
||||
} _xs_doubleints;
|
||||
|
||||
FUNCMATH FUNCINLINE static ATTRINLINE int xs_CRoundToInt(real64 val)
|
||||
{
|
||||
_xs_doubleints uval;
|
||||
uval.val = val + 6755399441055744.0;
|
||||
return uval.ival[_xs_iman_];
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
fixed_t x;
|
||||
|
||||
@@ -102,40 +102,6 @@ TMatrix *RotateYMatrix(angle_t rad);
|
||||
#endif
|
||||
TMatrix *RotateZMatrix(angle_t rad);
|
||||
|
||||
/** \brief The xs_CRoundToInt function
|
||||
|
||||
\param val double number
|
||||
|
||||
\return Round toward nearest, but ties round toward even
|
||||
*/
|
||||
#if defined(SRB2_BIG_ENDIAN)
|
||||
#define _xs_iexp_ 0
|
||||
#define _xs_iman_ 1
|
||||
#else
|
||||
#define _xs_iexp_ 1 //intel is little endian
|
||||
#define _xs_iman_ 0
|
||||
#endif //BigEndian_
|
||||
|
||||
typedef double real64;
|
||||
|
||||
typedef union _xs_doubleints
|
||||
{
|
||||
real64 val;
|
||||
unsigned ival[2];
|
||||
} _xs_doubleints;
|
||||
|
||||
FUNCMATH FUNCINLINE static ATTRINLINE int xs_CRoundToInt(real64 val)
|
||||
{
|
||||
_xs_doubleints uval;
|
||||
uval.val = val + 6755399441055744.0;
|
||||
return uval.ival[_xs_iman_];
|
||||
}
|
||||
|
||||
FUNCMATH FUNCINLINE static ATTRINLINE unsigned xs_CRoundToUInt(real64 val)
|
||||
{
|
||||
return (unsigned)xs_CRoundToInt(val);
|
||||
}
|
||||
|
||||
// s1 = s2+s3+s1 (1024 lenghtmax)
|
||||
void strcatbf(char *s1, const char *s2, const char *s3);
|
||||
|
||||
|
||||
@@ -366,45 +366,6 @@ angle_t R_PointToAngle2(fixed_t pviewx, fixed_t pviewy, fixed_t x, fixed_t y)
|
||||
0;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// ! 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.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#define EPSILON 1e-2
|
||||
|
||||
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 - (double)viewx;
|
||||
double vecy = (double)y - (double)viewy;
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
#undef EPSILON
|
||||
|
||||
angle_t R_PlayerSliptideAngle(player_t *player)
|
||||
{
|
||||
mobj_t *mo;
|
||||
|
||||
@@ -125,7 +125,6 @@ FUNCINLINE static ATTRINLINE PUREFUNC INT32 R_PointOnSegSide(fixed_t x, fixed_t
|
||||
|
||||
angle_t R_PointToAngle(fixed_t x, fixed_t y);
|
||||
angle_t R_PointToAngle64(INT64 x, INT64 y);
|
||||
angle_t R_PointToPseudoAngle(fixed_t x, fixed_t y);
|
||||
angle_t R_PointToAngle2(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