Skip to content

Commit

Permalink
- use PlanesAtPointf in most places where PlanesAtPoint was used.
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed Feb 15, 2022
1 parent 02d508b commit bd95da4
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions source/core/rendering/hw_vertexmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ void vertex_t::RecalcVertexHeights()
{
float heights[2];

auto point = wall[masterwall].wall_int_pos();
PlanesAtPoint(&sector[sect], point.X, point.Y, &heights[0], &heights[1]);
auto point = wall[masterwall].pos;
PlanesAtPointf(&sector[sect], point.X, point.Y, &heights[0], &heights[1]);
for(auto height : heights)
{
int k;
Expand Down
8 changes: 4 additions & 4 deletions source/core/rendering/scene/hw_bunchdrawer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,11 @@ bool BunchDrawer::CheckClip(walltype* wal, float* topclip, float* bottomclip)
// Mirrors and horizons always block the view
//if (linedef->special==Line_Mirror || linedef->special==Line_Horizon) return true;

PlanesAtPoint(frontsector, wal->wall_int_pos().X, wal->wall_int_pos().Y, &fs_ceilingheight1, &fs_floorheight1);
PlanesAtPoint(frontsector, pt2->wall_int_pos().X, pt2->wall_int_pos().Y, &fs_ceilingheight2, &fs_floorheight2);
PlanesAtPointf(frontsector, wal->pos.X, wal->pos.Y, &fs_ceilingheight1, &fs_floorheight1);
PlanesAtPointf(frontsector, pt2->pos.X, pt2->pos.Y, &fs_ceilingheight2, &fs_floorheight2);

PlanesAtPoint(backsector, wal->wall_int_pos().X, wal->wall_int_pos().Y, &bs_ceilingheight1, &bs_floorheight1);
PlanesAtPoint(backsector, pt2->wall_int_pos().X, pt2->wall_int_pos().Y, &bs_ceilingheight2, &bs_floorheight2);
PlanesAtPointf(backsector, wal->pos.X, wal->pos.Y, &bs_ceilingheight1, &bs_floorheight1);
PlanesAtPointf(backsector, pt2->pos.X, pt2->pos.Y, &bs_ceilingheight2, &bs_floorheight2);

*bottomclip = max(min(bs_floorheight1, bs_floorheight2), min(fs_floorheight1, fs_floorheight2));

Expand Down
2 changes: 1 addition & 1 deletion source/core/rendering/scene/hw_flats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ void HWFlat::ProcessSector(HWDrawInfo *di, sectortype * frontsector, int section
const auto &vp = di->Viewpoint;

float florz, ceilz;
PlanesAtPoint(frontsector, float(vp.Pos.X) * 16.f, float(vp.Pos.Y) * -16.f, &ceilz, &florz);
PlanesAtPointf(frontsector, vp.Pos.X, -vp.Pos.Y, &ceilz, &florz);

visibility = sectorVisibility(frontsector);
sec = frontsector;
Expand Down
8 changes: 4 additions & 4 deletions source/core/rendering/scene/hw_walls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -914,8 +914,8 @@ void HWWall::Process(HWDrawInfo* di, walltype* wal, sectortype* frontsector, sec
FVector2 v1(WallStartX(wal), WallStartY(wal));
FVector2 v2(WallEndX(wal), WallEndY(wal));

PlanesAtPoint(frontsector, wal->wall_int_pos().X, wal->wall_int_pos().Y, &fch1, &ffh1);
PlanesAtPoint(frontsector, p2wall->wall_int_pos().X, p2wall->wall_int_pos().Y, &fch2, &ffh2);
PlanesAtPointf(frontsector, wal->pos.X, wal->pos.Y, &fch1, &ffh1);
PlanesAtPointf(frontsector, p2wall->pos.X, p2wall->pos.Y, &fch2, &ffh2);


#ifdef _DEBUG
Expand Down Expand Up @@ -1008,8 +1008,8 @@ void HWWall::Process(HWDrawInfo* di, walltype* wal, sectortype* frontsector, sec
float bfh2;
float bch1;
float bch2;
PlanesAtPoint(backsector, wal->wall_int_pos().X, wal->wall_int_pos().Y, &bch1, &bfh1);
PlanesAtPoint(backsector, p2wall->wall_int_pos().X, p2wall->wall_int_pos().Y, &bch2, &bfh2);
PlanesAtPointf(backsector, wal->pos.X, wal->pos.Y, &bch1, &bfh1);
PlanesAtPointf(backsector, p2wall->pos.X, p2wall->pos.Y, &bch2, &bfh2);

SkyTop(di, wal, frontsector, backsector, v1, v2, fch1, fch2);
SkyBottom(di, wal, frontsector, backsector, v1, v2, ffh1, ffh2);
Expand Down
8 changes: 4 additions & 4 deletions source/core/sectorgeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ static FVector3 CalcNormal(sectortype* sector, int plane)

pt[0] = { (float)WallStartX(wal), 0.f, (float)WallStartY(wal)};
pt[1] = { (float)WallStartX(wal2), 0.f, (float)WallStartY(wal2)};
PlanesAtPoint(sector, wal->wall_int_pos().X, wal->wall_int_pos().Y, plane ? &pt[0].Z : nullptr, plane? nullptr : &pt[0].Y);
PlanesAtPoint(sector, wal2->wall_int_pos().X, wal2->wall_int_pos().Y, plane ? &pt[1].Z : nullptr, plane ? nullptr : &pt[1].Y);
PlanesAtPointf(sector, wal->pos.X, wal->pos.Y, plane ? &pt[0].Z : nullptr, plane? nullptr : &pt[0].Y);
PlanesAtPointf(sector, wal2->pos.X, wal2->pos.Y, plane ? &pt[1].Z : nullptr, plane ? nullptr : &pt[1].Y);

if (pt[0].X == pt[1].X)
{
Expand All @@ -77,7 +77,7 @@ static FVector3 CalcNormal(sectortype* sector, int plane)
pt[2].X = pt[0].X;
pt[2].Z = pt[0].Z + 4;
}
PlanesAtPoint(sector, pt[2].X * 16, pt[2].Z * -16, plane ? &pt[2].Z : nullptr, plane ? nullptr : &pt[2].Y);
PlanesAtPointf(sector, pt[2].X, -pt[2].Z, plane ? &pt[2].Y : nullptr, plane ? nullptr : &pt[2].Y);

auto normal = ((pt[2] - pt[0]) ^ (pt[1] - pt[0])).Unit();
if ((normal.Y < 0 && !plane) || (normal.Y > 0 && plane)) return -normal;
Expand Down Expand Up @@ -453,7 +453,7 @@ void SectionGeometry::CreatePlaneMesh(Section* section, int plane, const FVector
auto& tc = entry.texcoords[i];

pt.X = org.X; pt.Y = org.Y;
PlanesAtPoint(sectorp, (pt.X * 16), (pt.Y * -16), plane ? &pt.Z : nullptr, !plane ? &pt.Z : nullptr);
PlanesAtPointf(sectorp, pt.X, -pt.Y, plane ? &pt.Z : nullptr, !plane ? &pt.Z : nullptr);
tc = uvcalc.GetUV(int(pt.X * 16.), int(pt.Y * -16.), pt.Z);
}
sectorp->setfloorz(fz, true);
Expand Down

0 comments on commit bd95da4

Please sign in to comment.