mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
This version of equation() compiles into fewer instructions
git-svn-id: https://svn.eduke32.com/eduke32@7592 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
413d68f1f8
commit
80d77f64cf
1 changed files with 4 additions and 12 deletions
|
@ -8289,24 +8289,16 @@ int32_t renderDrawRoomsQ16(int32_t daposx, int32_t daposy, int32_t daposz,
|
|||
// returns equation of a line given two points
|
||||
static inline _equation equation(float const x1, float const y1, float const x2, float const y2)
|
||||
{
|
||||
_equation ret;
|
||||
const float f = x2-x1;
|
||||
|
||||
// vertical
|
||||
if (f == 0.f)
|
||||
return { 1, 0, -x1 };
|
||||
else
|
||||
{
|
||||
ret.a = 1;
|
||||
ret.b = 0;
|
||||
ret.c = -x1;
|
||||
|
||||
return ret;
|
||||
float const ff = (y2 - y1) / f;
|
||||
return { ff, -1, (y1 - (ff * x1)) };
|
||||
}
|
||||
|
||||
ret.a = (float) (y2 - y1)/f;
|
||||
ret.b = -1;
|
||||
ret.c = (y1 - (ret.a * x1));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t wallvisible(int32_t const x, int32_t const y, int16_t const wallnum)
|
||||
|
|
Loading…
Reference in a new issue