- use locally stored viewpoint variables in the hardware renderer.

- move a few variables from SceneDrawer to FRenderViewpoint.

The global r_viewpoint variable is left alone now to always represent the current viewpoint to the play code.
The main reason behind this change is to reduce the amount of global variables being used by the hardware renderer's scene processing code.
This commit is contained in:
Christoph Oelckers 2018-06-19 23:16:22 +02:00
commit 54970b60e8
26 changed files with 221 additions and 217 deletions

View file

@ -88,7 +88,7 @@ void HWDrawInfo::ClearBuffers()
void HWDrawInfo::UpdateCurrentMapSection()
{
const int mapsection = R_PointInSubsector(r_viewpoint.Pos)->mapsection;
const int mapsection = R_PointInSubsector(Viewpoint.Pos)->mapsection;
CurrentMapSections.Set(mapsection);
}
@ -484,7 +484,7 @@ void HWDrawInfo::HandleMissingTextures(area_t in_area)
HandledSubsectors.Clear();
validcount++;
if (MissingUpperTextures[i].Planez > r_viewpoint.Pos.Z)
if (MissingUpperTextures[i].Planez > Viewpoint.Pos.Z)
{
// close the hole only if all neighboring sectors are an exact height match
// Otherwise just fill in the missing textures.
@ -556,7 +556,7 @@ void HWDrawInfo::HandleMissingTextures(area_t in_area)
HandledSubsectors.Clear();
validcount++;
if (MissingLowerTextures[i].Planez < r_viewpoint.Pos.Z)
if (MissingLowerTextures[i].Planez < Viewpoint.Pos.Z)
{
// close the hole only if all neighboring sectors are an exact height match
// Otherwise just fill in the missing textures.
@ -642,7 +642,7 @@ void HWDrawInfo::DrawUnhandledMissingTextures()
// already done!
if (seg->linedef->validcount == validcount) continue; // already done
seg->linedef->validcount = validcount;
if (seg->frontsector->GetPlaneTexZ(sector_t::ceiling) < r_viewpoint.Pos.Z) continue; // out of sight
if (seg->frontsector->GetPlaneTexZ(sector_t::ceiling) < Viewpoint.Pos.Z) continue; // out of sight
// FIXME: The check for degenerate subsectors should be more precise
if (seg->PartnerSeg && (seg->PartnerSeg->Subsector->flags & SSECF_DEGENERATE)) continue;
@ -664,7 +664,7 @@ void HWDrawInfo::DrawUnhandledMissingTextures()
if (seg->linedef->validcount == validcount) continue; // already done
seg->linedef->validcount = validcount;
if (!(sectorrenderflags[seg->backsector->sectornum] & SSRF_RENDERFLOOR)) continue;
if (seg->frontsector->GetPlaneTexZ(sector_t::floor) > r_viewpoint.Pos.Z) continue; // out of sight
if (seg->frontsector->GetPlaneTexZ(sector_t::floor) > Viewpoint.Pos.Z) continue; // out of sight
if (seg->backsector->transdoor) continue;
if (seg->backsector->GetTexture(sector_t::floor) == skyflatnum) continue;
if (seg->backsector->ValidatePortal(sector_t::floor) != NULL) continue;
@ -757,7 +757,7 @@ bool HWDrawInfo::CollectSubsectorsFloor(subsector_t * sub, sector_t * anchor)
sub->render_sector->GetPlaneTexZ(sector_t::floor) != anchor->GetPlaneTexZ(sector_t::floor) ||
sub->render_sector->GetFloorLight() != anchor->GetFloorLight())
{
if (sub == viewsubsector && r_viewpoint.Pos.Z < anchor->GetPlaneTexZ(sector_t::floor)) inview = true;
if (sub == viewsubsector && Viewpoint.Pos.Z < anchor->GetPlaneTexZ(sector_t::floor)) inview = true;
HandledSubsectors.Push(sub);
}
}
@ -903,7 +903,7 @@ bool HWDrawInfo::CollectSubsectorsCeiling(subsector_t * sub, sector_t * anchor)
void HWDrawInfo::HandleHackedSubsectors()
{
viewsubsector = R_PointInSubsector(r_viewpoint.Pos);
viewsubsector = R_PointInSubsector(Viewpoint.Pos);
// Each subsector may only be processed once in this loop!
validcount++;