- Change all remaining BunchDrawer properties from binangle to angle_t types.

This commit is contained in:
Mitchell Richters 2022-08-27 19:54:55 +10:00 committed by Christoph Oelckers
parent e6fe9b7031
commit 4f56138027
3 changed files with 33 additions and 33 deletions

View file

@ -53,10 +53,10 @@
//
//==========================================================================
void BunchDrawer::Init(HWDrawInfo *_di, Clipper* c, vec2_t& view, binangle a1, binangle a2)
void BunchDrawer::Init(HWDrawInfo *_di, Clipper* c, vec2_t& view, angle_t a1, angle_t a2)
{
ang1 = a1.asbam();
ang2 = a2.asbam();
ang1 = a1;
ang2 = a2;
angrange = ang2 - ang1;
di = _di;
clipper = c;
@ -110,14 +110,14 @@ void BunchDrawer::StartScene()
//
//==========================================================================
bool BunchDrawer::StartBunch(int sectnum, int linenum, binangle startan, binangle endan, bool portal)
bool BunchDrawer::StartBunch(int sectnum, int linenum, angle_t startan, angle_t endan, bool portal)
{
FBunch* bunch = &Bunches[LastBunch = Bunches.Reserve(1)];
bunch->sectornum = sectnum;
bunch->startline = bunch->endline = linenum;
bunch->startangle = startan.asbam();
bunch->endangle = endan.asbam();
bunch->startangle = startan;
bunch->endangle = endan;
bunch->portal = portal;
assert(bunch->endangle >= bunch->startangle);
return bunch->endangle != angrange;
@ -129,11 +129,11 @@ bool BunchDrawer::StartBunch(int sectnum, int linenum, binangle startan, binangl
//
//==========================================================================
bool BunchDrawer::AddLineToBunch(int line, binangle newan)
bool BunchDrawer::AddLineToBunch(int line, angle_t newan)
{
Bunches[LastBunch].endline++;
assert(newan.asbam() > Bunches[LastBunch].endangle);
Bunches[LastBunch].endangle = newan.asbam();
assert(newan > Bunches[LastBunch].endangle);
Bunches[LastBunch].endangle = newan;
assert(Bunches[LastBunch].endangle > Bunches[LastBunch].startangle);
return Bunches[LastBunch].endangle != angrange;
}
@ -231,15 +231,15 @@ int BunchDrawer::ClipLine(int aline, bool portal)
auto endAngleBam = ClipAngle(cline->endpoint);
// Back side, i.e. backface culling - read: endAngle <= startAngle!
if (startAngleBam.asbam() - endAngleBam.asbam() < ANGLE_180)
if (startAngleBam - endAngleBam < ANGLE_180)
{
return CL_Skip;
}
//if (line >= 0 && blockwall[line]) return CL_Draw;
// convert to clipper coordinates and clamp to valid range.
int startAngle = startAngleBam.asbam();
int endAngle = endAngleBam.asbam();
int startAngle = startAngleBam;
int endAngle = endAngleBam;
if (startAngle < 0) startAngle = 0;
if (endAngle < 0 || endAngle > (int)angrange) endAngle = angrange;
@ -527,19 +527,19 @@ int BunchDrawer::ColinearBunchInFront(FBunch* b1, FBunch* b2)
int BunchDrawer::BunchInFront(FBunch* b1, FBunch* b2)
{
binangle anglecheck, endang;
angle_t anglecheck, endang;
bool colinear = false;
if (b2->startangle >= b1->startangle && b2->startangle < b1->endangle)
{
// we have an overlap at b2->startangle
anglecheck = bamang(b2->startangle);
anglecheck = b2->startangle;
// Find the wall in b1 that overlaps b2->startangle
for (int i = b1->startline; i <= b1->endline; i++)
{
endang = ClipAngle(sectionLines[i].endpoint);
if (endang.asbam() > anglecheck.asbam())
if (endang > anglecheck)
{
// found a line
int ret = WallInFront(b2->startline, i);
@ -559,13 +559,13 @@ int BunchDrawer::BunchInFront(FBunch* b1, FBunch* b2)
else if (b1->startangle >= b2->startangle && b1->startangle < b2->endangle)
{
// we have an overlap at b1->startangle
anglecheck = bamang(b1->startangle);
anglecheck = b1->startangle;
// Find the wall in b2 that overlaps b1->startangle
for (int i = b2->startline; i <= b2->endline; i++)
{
endang = ClipAngle(sectionLines[i].endpoint);
if (endang.asbam() > anglecheck.asbam())
if (endang > anglecheck)
{
// found a line
int ret = WallInFront(i, b1->startline);
@ -711,19 +711,19 @@ void BunchDrawer::ProcessSection(int sectionnum, bool portal)
{
auto thisline = &sectionLines[section->lines[i]];
binangle walang1 = ClipAngle(thisline->startpoint);
binangle walang2 = ClipAngle(thisline->endpoint);
angle_t walang1 = ClipAngle(thisline->startpoint);
angle_t walang2 = ClipAngle(thisline->endpoint);
// outside the visible area or seen from the backside.
if ((walang1.asbam() > angrange && walang2.asbam() > angrange && walang1.asbam() < walang2.asbam()) ||
(walang1.asbam() - walang2.asbam() < ANGLE_180))
if ((walang1 > angrange && walang2 > angrange && walang1 < walang2) ||
(walang1 - walang2 < ANGLE_180))
{
inbunch = false;
}
else
{
if (walang1.asbam() >= angrange) { walang1 = bamang(0); inbunch = false; }
if (walang2.asbam() >= angrange) walang2 = bamang(angrange);
if (walang1 >= angrange) { walang1 = 0; inbunch = false; }
if (walang2 >= angrange) walang2 = angrange;
if (section->lines[i] >= (int)wall.Size()) inbunch = false;
if (!inbunch)
{

View file

@ -45,10 +45,10 @@ private:
CL_Pass = 2,
};
binangle ClipAngle(int wal) { return bamang(wall[wal].clipangle - ang1); }
angle_t ClipAngle(int wal) { return wall[wal].clipangle - ang1; }
void StartScene();
bool StartBunch(int sectnum, int linenum, binangle startan, binangle endan, bool portal);
bool AddLineToBunch(int line, binangle newan);
bool StartBunch(int sectnum, int linenum, angle_t startan, angle_t endan, bool portal);
bool AddLineToBunch(int line, angle_t newan);
void DeleteBunch(int index);
bool CheckClip(walltype* wal, float* topclip, float* bottomclip);
int ClipLine(int line, bool portal);
@ -60,7 +60,7 @@ private:
void ProcessSection(int sectnum, bool portal);
public:
void Init(HWDrawInfo* _di, Clipper* c, vec2_t& view, binangle a1, binangle a2);
void Init(HWDrawInfo* _di, Clipper* c, vec2_t& view, angle_t a1, angle_t a2);
void RenderScene(const int* viewsectors, unsigned sectcount, bool portal);
const BitArray& GotSector() const { return gotsector; }
};

View file

@ -386,8 +386,8 @@ void HWDrawInfo::CreateScene(bool portal)
if(!portal) mClipper->SetVisibleRange(vp.RotAngle, a1);
if (a1 != 0xffffffff) mDrawer.Init(this, mClipper, view, bamang(vp.RotAngle - a1), bamang(vp.RotAngle + a1));
else mDrawer.Init(this, mClipper, view, bamang(0), bamang(0));
if (a1 != 0xffffffff) mDrawer.Init(this, mClipper, view, vp.RotAngle - a1, vp.RotAngle + a1);
else mDrawer.Init(this, mClipper, view, 0, 0);
if (vp.SectNums)
mDrawer.RenderScene(vp.SectNums, vp.SectCount, portal);
else
@ -422,8 +422,8 @@ void HWDrawInfo::CreateScene(bool portal)
if (eff.geosector[i] == drawsectp) drawsectp = eff.geosectorwarp[i];
}
if (a1 != 0xffffffff) mDrawer.Init(this, mClipper, view, bamang(vp.RotAngle - a1), bamang(vp.RotAngle + a1));
else mDrawer.Init(this, mClipper, view, bamang(0), bamang(0));
if (a1 != 0xffffffff) mDrawer.Init(this, mClipper, view, vp.RotAngle - a1, vp.RotAngle + a1);
else mDrawer.Init(this, mClipper, view, 0, 0);
int drawsect = sectnum(drawsectp);
mDrawer.RenderScene(&drawsect, 1, false);
@ -454,8 +454,8 @@ void HWDrawInfo::CreateScene(bool portal)
if (eff.geosector[i] == orgdrawsectp) drawsectp = eff.geosectorwarp2[i];
}
if (a1 != 0xffffffff) mDrawer.Init(this, mClipper, view, bamang(vp.RotAngle - a1), bamang(vp.RotAngle + a1));
else mDrawer.Init(this, mClipper, view, bamang(0), bamang(0));
if (a1 != 0xffffffff) mDrawer.Init(this, mClipper, view, vp.RotAngle - a1, vp.RotAngle + a1);
else mDrawer.Init(this, mClipper, view, 0, 0);
drawsect = sectnum(drawsectp);
mDrawer.RenderScene(&drawsect, 1, false);