Split FDrawInfo in two

Done so that the entire gl_renderhacks.cpp file can be moved out of the GL folder.
Not cleaned up yet
This commit is contained in:
Christoph Oelckers 2018-04-24 10:30:26 +02:00
parent 45625399dc
commit a803b3d393
5 changed files with 157 additions and 138 deletions

View file

@ -234,13 +234,7 @@ public:
static float GetZFar() { return 65536.f; } static float GetZFar() { return 65536.f; }
}; };
enum area_t enum area_t : int;
{
area_normal,
area_below,
area_above,
area_default
};
// Global functions. Make them members of GLRenderer later? // Global functions. Make them members of GLRenderer later?

View file

@ -1307,3 +1307,15 @@ void FDrawInfo::FloodLowerGap(seg_t * seg)
// Step3: Delete the stencil // Step3: Delete the stencil
ClearFloodStencil(&ws); ClearFloodStencil(&ws);
} }
// This was temporarily moved out of gl_renderhacks.cpp so that the dependency on GLWall could be eliminated until things have progressed a bit.
void FDrawInfo::ProcessLowerMinisegs(TArray<seg_t *> &lowersegs)
{
for(unsigned int j=0;j<lowersegs.Size();j++)
{
seg_t * seg=lowersegs[j];
GLWall wall(mDrawer);
wall.ProcessLowerMiniseg(seg, seg->Subsector->render_sector, seg->PartnerSeg->Subsector->render_sector);
rendered_lines++;
}
}

View file

@ -105,7 +105,7 @@ struct SortNode
struct GLDrawList struct GLDrawList
{ {
//private: //private:
TArray<GLWall*> walls; TArray<GLWall*> walls;
TArray<GLFlat*> flats; TArray<GLFlat*> flats;
TArray<GLSprite*> sprites; TArray<GLSprite*> sprites;
@ -174,18 +174,23 @@ struct gl_subsectorrendernode
subsector_t * sub; subsector_t * sub;
}; };
enum area_t : int
struct FDrawInfo
{ {
area_normal,
area_below,
area_above,
area_default
};
struct HWDrawInfo
{
virtual ~HWDrawInfo() {}
struct wallseg struct wallseg
{ {
float x1, y1, z1, x2, y2, z2; float x1, y1, z1, x2, y2, z2;
}; };
bool temporary;
struct MissingTextureInfo struct MissingTextureInfo
{ {
seg_t * seg; seg_t * seg;
@ -197,7 +202,7 @@ struct FDrawInfo
struct MissingSegInfo struct MissingSegInfo
{ {
seg_t * seg; seg_t * seg;
int MTI_Index; // tells us which MissingTextureInfo represents this seg. int MTI_Index; // tells us which MissingTextureInfo represents this seg.
}; };
struct SubsectorHackInfo struct SubsectorHackInfo
@ -206,12 +211,6 @@ struct FDrawInfo
uint8_t flags; uint8_t flags;
}; };
GLSceneDrawer *mDrawer;
TArray<uint8_t> sectorrenderflags;
TArray<uint8_t> ss_renderflags;
TArray<uint8_t> no_renderflags;
TArray<MissingTextureInfo> MissingUpperTextures; TArray<MissingTextureInfo> MissingUpperTextures;
TArray<MissingTextureInfo> MissingLowerTextures; TArray<MissingTextureInfo> MissingLowerTextures;
@ -228,48 +227,68 @@ struct FDrawInfo
TArray<subsector_t *> HandledSubsectors; TArray<subsector_t *> HandledSubsectors;
TArray<uint8_t> sectorrenderflags;
TArray<uint8_t> ss_renderflags;
TArray<uint8_t> no_renderflags;
void ClearBuffers();
bool DoOneSectorUpper(subsector_t * subsec, float planez, area_t in_area);
bool DoOneSectorLower(subsector_t * subsec, float planez, area_t in_area);
bool DoFakeBridge(subsector_t * subsec, float planez, area_t in_area);
bool DoFakeCeilingBridge(subsector_t * subsec, float planez, area_t in_area);
bool CheckAnchorFloor(subsector_t * sub);
bool CollectSubsectorsFloor(subsector_t * sub, sector_t * anchor);
bool CheckAnchorCeiling(subsector_t * sub);
bool CollectSubsectorsCeiling(subsector_t * sub, sector_t * anchor);
void CollectSectorStacksCeiling(subsector_t * sub, sector_t * anchor, area_t in_area);
void CollectSectorStacksFloor(subsector_t * sub, sector_t * anchor, area_t in_area);
void AddUpperMissingTexture(side_t * side, subsector_t *sub, float backheight);
void AddLowerMissingTexture(side_t * side, subsector_t *sub, float backheight);
void HandleMissingTextures(area_t in_area);
void DrawUnhandledMissingTextures();
void AddHackedSubsector(subsector_t * sub);
void HandleHackedSubsectors();
void AddFloorStack(sector_t * sec);
void AddCeilingStack(sector_t * sec);
void ProcessSectorStacks(area_t in_area);
void AddOtherFloorPlane(int sector, gl_subsectorrendernode * node);
void AddOtherCeilingPlane(int sector, gl_subsectorrendernode * node);
virtual void FloodUpperGap(seg_t * seg) = 0;
virtual void FloodLowerGap(seg_t * seg) = 0;
virtual void ProcessLowerMinisegs(TArray<seg_t *> &lowersegs) = 0;
};
struct FDrawInfo : public HWDrawInfo
{
GLSceneDrawer *mDrawer;
FDrawInfo * next; FDrawInfo * next;
GLDrawList drawlists[GLDL_TYPES]; GLDrawList drawlists[GLDL_TYPES];
GLDrawList *dldrawlists = NULL; // only gets allocated when needed. GLDrawList *dldrawlists = NULL; // only gets allocated when needed.
FDrawInfo(); FDrawInfo();
~FDrawInfo(); ~FDrawInfo();
void ClearBuffers();
void AddWall(GLWall *wall); void AddWall(GLWall *wall);
bool PutWallCompat(GLWall *wall, int passflag); // Legacy GL only. bool PutWallCompat(GLWall *wall, int passflag); // Legacy GL only.
bool DoOneSectorUpper(subsector_t * subsec, float planez);
bool DoOneSectorLower(subsector_t * subsec, float planez);
bool DoFakeBridge(subsector_t * subsec, float planez);
bool DoFakeCeilingBridge(subsector_t * subsec, float planez);
bool CheckAnchorFloor(subsector_t * sub);
bool CollectSubsectorsFloor(subsector_t * sub, sector_t * anchor);
bool CheckAnchorCeiling(subsector_t * sub);
bool CollectSubsectorsCeiling(subsector_t * sub, sector_t * anchor);
void CollectSectorStacksCeiling(subsector_t * sub, sector_t * anchor);
void CollectSectorStacksFloor(subsector_t * sub, sector_t * anchor);
void AddUpperMissingTexture(side_t * side, subsector_t *sub, float backheight);
void AddLowerMissingTexture(side_t * side, subsector_t *sub, float backheight);
void HandleMissingTextures();
void DrawUnhandledMissingTextures();
void AddHackedSubsector(subsector_t * sub);
void HandleHackedSubsectors();
void AddFloorStack(sector_t * sec);
void AddCeilingStack(sector_t * sec);
void ProcessSectorStacks();
void AddOtherFloorPlane(int sector, gl_subsectorrendernode * node);
void AddOtherCeilingPlane(int sector, gl_subsectorrendernode * node);
void StartScene(); void StartScene();
void SetupFloodStencil(wallseg * ws); void SetupFloodStencil(wallseg * ws);
void ClearFloodStencil(wallseg * ws); void ClearFloodStencil(wallseg * ws);
void DrawFloodedPlane(wallseg * ws, float planez, sector_t * sec, bool ceiling); void DrawFloodedPlane(wallseg * ws, float planez, sector_t * sec, bool ceiling);
void FloodUpperGap(seg_t * seg); void FloodUpperGap(seg_t * seg) override;
void FloodLowerGap(seg_t * seg); void FloodLowerGap(seg_t * seg) override;
void ProcessLowerMinisegs(TArray<seg_t *> &lowersegs) override;
static void StartDrawInfo(GLSceneDrawer *drawer); static void StartDrawInfo(GLSceneDrawer *drawer);
static void EndDrawInfo(); static void EndDrawInfo();

View file

@ -55,7 +55,7 @@ static subsector_t * viewsubsector;
static TArray<seg_t *> lowersegs; static TArray<seg_t *> lowersegs;
void FDrawInfo::ClearBuffers() void HWDrawInfo::ClearBuffers()
{ {
for(unsigned int i=0;i< otherfloorplanes.Size();i++) for(unsigned int i=0;i< otherfloorplanes.Size();i++)
{ {
@ -98,7 +98,7 @@ void FDrawInfo::ClearBuffers()
// //
//========================================================================== //==========================================================================
void FDrawInfo::AddOtherFloorPlane(int sector, gl_subsectorrendernode * node) void HWDrawInfo::AddOtherFloorPlane(int sector, gl_subsectorrendernode * node)
{ {
int oldcnt = otherfloorplanes.Size(); int oldcnt = otherfloorplanes.Size();
@ -111,7 +111,7 @@ void FDrawInfo::AddOtherFloorPlane(int sector, gl_subsectorrendernode * node)
otherfloorplanes[sector] = node; otherfloorplanes[sector] = node;
} }
void FDrawInfo::AddOtherCeilingPlane(int sector, gl_subsectorrendernode * node) void HWDrawInfo::AddOtherCeilingPlane(int sector, gl_subsectorrendernode * node)
{ {
int oldcnt = otherceilingplanes.Size(); int oldcnt = otherceilingplanes.Size();
@ -130,7 +130,7 @@ void FDrawInfo::AddOtherCeilingPlane(int sector, gl_subsectorrendernode * node)
// Collects all sectors that might need a fake ceiling // Collects all sectors that might need a fake ceiling
// //
//========================================================================== //==========================================================================
void FDrawInfo::AddUpperMissingTexture(side_t * side, subsector_t *sub, float Backheight) void HWDrawInfo::AddUpperMissingTexture(side_t * side, subsector_t *sub, float Backheight)
{ {
if (!side->segs[0]->backsector) return; if (!side->segs[0]->backsector) return;
@ -186,7 +186,7 @@ void FDrawInfo::AddUpperMissingTexture(side_t * side, subsector_t *sub, float Ba
// Collects all sectors that might need a fake floor // Collects all sectors that might need a fake floor
// //
//========================================================================== //==========================================================================
void FDrawInfo::AddLowerMissingTexture(side_t * side, subsector_t *sub, float Backheight) void HWDrawInfo::AddLowerMissingTexture(side_t * side, subsector_t *sub, float Backheight)
{ {
sector_t *backsec = side->segs[0]->backsector; sector_t *backsec = side->segs[0]->backsector;
if (!backsec) return; if (!backsec) return;
@ -259,7 +259,7 @@ void FDrawInfo::AddLowerMissingTexture(side_t * side, subsector_t *sub, float Ba
// //
// //
//========================================================================== //==========================================================================
bool FDrawInfo::DoOneSectorUpper(subsector_t * subsec, float Planez) bool HWDrawInfo::DoOneSectorUpper(subsector_t * subsec, float Planez, area_t in_area)
{ {
// Is there a one-sided wall in this sector? // Is there a one-sided wall in this sector?
// Do this first to avoid unnecessary recursion // Do this first to avoid unnecessary recursion
@ -283,7 +283,7 @@ bool FDrawInfo::DoOneSectorUpper(subsector_t * subsec, float Planez)
// Note: if this is a real line between sectors // Note: if this is a real line between sectors
// we can be sure that render_sector is the real sector! // we can be sure that render_sector is the real sector!
sector_t * sec = gl_FakeFlat(seg->backsector, &fakesec, mDrawer->in_area, true); sector_t * sec = gl_FakeFlat(seg->backsector, &fakesec, in_area, true);
// Don't bother with slopes // Don't bother with slopes
if (sec->ceilingplane.isSlope()) return false; if (sec->ceilingplane.isSlope()) return false;
@ -304,7 +304,7 @@ bool FDrawInfo::DoOneSectorUpper(subsector_t * subsec, float Planez)
else return false; else return false;
} }
} }
if (!DoOneSectorUpper(backsub, Planez)) return false; if (!DoOneSectorUpper(backsub, Planez, in_area)) return false;
} }
// all checked ok. This subsector is part of the current fake plane // all checked ok. This subsector is part of the current fake plane
@ -317,7 +317,7 @@ bool FDrawInfo::DoOneSectorUpper(subsector_t * subsec, float Planez)
// //
// //
//========================================================================== //==========================================================================
bool FDrawInfo::DoOneSectorLower(subsector_t * subsec, float Planez) bool HWDrawInfo::DoOneSectorLower(subsector_t * subsec, float Planez, area_t in_area)
{ {
// Is there a one-sided wall in this subsector? // Is there a one-sided wall in this subsector?
// Do this first to avoid unnecessary recursion // Do this first to avoid unnecessary recursion
@ -341,7 +341,7 @@ bool FDrawInfo::DoOneSectorLower(subsector_t * subsec, float Planez)
// Note: if this is a real line between sectors // Note: if this is a real line between sectors
// we can be sure that render_sector is the real sector! // we can be sure that render_sector is the real sector!
sector_t * sec = gl_FakeFlat(seg->backsector, &fakesec, mDrawer->in_area, true); sector_t * sec = gl_FakeFlat(seg->backsector, &fakesec, in_area, true);
// Don't bother with slopes // Don't bother with slopes
if (sec->floorplane.isSlope()) return false; if (sec->floorplane.isSlope()) return false;
@ -362,7 +362,7 @@ bool FDrawInfo::DoOneSectorLower(subsector_t * subsec, float Planez)
else return false; else return false;
} }
} }
if (!DoOneSectorLower(backsub, Planez)) return false; if (!DoOneSectorLower(backsub, Planez, in_area)) return false;
} }
// all checked ok. This sector is part of the current fake plane // all checked ok. This sector is part of the current fake plane
@ -376,7 +376,7 @@ bool FDrawInfo::DoOneSectorLower(subsector_t * subsec, float Planez)
// //
// //
//========================================================================== //==========================================================================
bool FDrawInfo::DoFakeBridge(subsector_t * subsec, float Planez) bool HWDrawInfo::DoFakeBridge(subsector_t * subsec, float Planez, area_t in_area)
{ {
// Is there a one-sided wall in this sector? // Is there a one-sided wall in this sector?
// Do this first to avoid unnecessary recursion // Do this first to avoid unnecessary recursion
@ -400,7 +400,7 @@ bool FDrawInfo::DoFakeBridge(subsector_t * subsec, float Planez)
// Note: if this is a real line between sectors // Note: if this is a real line between sectors
// we can be sure that render_sector is the real sector! // we can be sure that render_sector is the real sector!
sector_t * sec = gl_FakeFlat(seg->backsector, &fakesec, mDrawer->in_area, true); sector_t * sec = gl_FakeFlat(seg->backsector, &fakesec, in_area, true);
// Don't bother with slopes // Don't bother with slopes
if (sec->floorplane.isSlope()) return false; if (sec->floorplane.isSlope()) return false;
@ -416,7 +416,7 @@ bool FDrawInfo::DoFakeBridge(subsector_t * subsec, float Planez)
// No texture checks though! // No texture checks though!
if (sec->GetPlaneTexZ(sector_t::floor) == Planez) continue; if (sec->GetPlaneTexZ(sector_t::floor) == Planez) continue;
} }
if (!DoFakeBridge(backsub, Planez)) return false; if (!DoFakeBridge(backsub, Planez, in_area)) return false;
} }
// all checked ok. This sector is part of the current fake plane // all checked ok. This sector is part of the current fake plane
@ -429,7 +429,7 @@ bool FDrawInfo::DoFakeBridge(subsector_t * subsec, float Planez)
// //
// //
//========================================================================== //==========================================================================
bool FDrawInfo::DoFakeCeilingBridge(subsector_t * subsec, float Planez) bool HWDrawInfo::DoFakeCeilingBridge(subsector_t * subsec, float Planez, area_t in_area)
{ {
// Is there a one-sided wall in this sector? // Is there a one-sided wall in this sector?
// Do this first to avoid unnecessary recursion // Do this first to avoid unnecessary recursion
@ -453,7 +453,7 @@ bool FDrawInfo::DoFakeCeilingBridge(subsector_t * subsec, float Planez)
// Note: if this is a real line between sectors // Note: if this is a real line between sectors
// we can be sure that render_sector is the real sector! // we can be sure that render_sector is the real sector!
sector_t * sec = gl_FakeFlat(seg->backsector, &fakesec, mDrawer->in_area, true); sector_t * sec = gl_FakeFlat(seg->backsector, &fakesec, in_area, true);
// Don't bother with slopes // Don't bother with slopes
if (sec->ceilingplane.isSlope()) return false; if (sec->ceilingplane.isSlope()) return false;
@ -469,7 +469,7 @@ bool FDrawInfo::DoFakeCeilingBridge(subsector_t * subsec, float Planez)
// No texture checks though! // No texture checks though!
if (sec->GetPlaneTexZ(sector_t::ceiling) == Planez) continue; if (sec->GetPlaneTexZ(sector_t::ceiling) == Planez) continue;
} }
if (!DoFakeCeilingBridge(backsub, Planez)) return false; if (!DoFakeCeilingBridge(backsub, Planez, in_area)) return false;
} }
// all checked ok. This sector is part of the current fake plane // all checked ok. This sector is part of the current fake plane
@ -483,7 +483,7 @@ bool FDrawInfo::DoFakeCeilingBridge(subsector_t * subsec, float Planez)
// Draws the fake planes // Draws the fake planes
// //
//========================================================================== //==========================================================================
void FDrawInfo::HandleMissingTextures() void HWDrawInfo::HandleMissingTextures(area_t in_area)
{ {
sector_t fake; sector_t fake;
totalms.Clock(); totalms.Clock();
@ -501,7 +501,7 @@ void FDrawInfo::HandleMissingTextures()
// close the hole only if all neighboring sectors are an exact height match // close the hole only if all neighboring sectors are an exact height match
// Otherwise just fill in the missing textures. // Otherwise just fill in the missing textures.
MissingUpperTextures[i].sub->validcount = validcount; MissingUpperTextures[i].sub->validcount = validcount;
if (DoOneSectorUpper(MissingUpperTextures[i].sub, MissingUpperTextures[i].Planez)) if (DoOneSectorUpper(MissingUpperTextures[i].sub, MissingUpperTextures[i].Planez, in_area))
{ {
sector_t * sec = MissingUpperTextures[i].seg->backsector; sector_t * sec = MissingUpperTextures[i].seg->backsector;
// The mere fact that this seg has been added to the list means that the back sector // The mere fact that this seg has been added to the list means that the back sector
@ -542,11 +542,11 @@ void FDrawInfo::HandleMissingTextures()
{ {
// It isn't a hole. Now check whether it might be a fake bridge // It isn't a hole. Now check whether it might be a fake bridge
sector_t * fakesector = gl_FakeFlat(MissingUpperTextures[i].seg->frontsector, &fake, mDrawer->in_area, false); sector_t * fakesector = gl_FakeFlat(MissingUpperTextures[i].seg->frontsector, &fake, in_area, false);
float planez = (float)fakesector->GetPlaneTexZ(sector_t::ceiling); float planez = (float)fakesector->GetPlaneTexZ(sector_t::ceiling);
backsub->validcount = validcount; backsub->validcount = validcount;
if (DoFakeCeilingBridge(backsub, planez)) if (DoFakeCeilingBridge(backsub, planez, in_area))
{ {
// The mere fact that this seg has been added to the list means that the back sector // The mere fact that this seg has been added to the list means that the back sector
// will be rendered so we can safely assume that it is already in the render list // will be rendered so we can safely assume that it is already in the render list
@ -573,7 +573,7 @@ void FDrawInfo::HandleMissingTextures()
// close the hole only if all neighboring sectors are an exact height match // close the hole only if all neighboring sectors are an exact height match
// Otherwise just fill in the missing textures. // Otherwise just fill in the missing textures.
MissingLowerTextures[i].sub->validcount = validcount; MissingLowerTextures[i].sub->validcount = validcount;
if (DoOneSectorLower(MissingLowerTextures[i].sub, MissingLowerTextures[i].Planez)) if (DoOneSectorLower(MissingLowerTextures[i].sub, MissingLowerTextures[i].Planez, in_area))
{ {
sector_t * sec = MissingLowerTextures[i].seg->backsector; sector_t * sec = MissingLowerTextures[i].seg->backsector;
// The mere fact that this seg has been added to the list means that the back sector // The mere fact that this seg has been added to the list means that the back sector
@ -613,11 +613,11 @@ void FDrawInfo::HandleMissingTextures()
{ {
// It isn't a hole. Now check whether it might be a fake bridge // It isn't a hole. Now check whether it might be a fake bridge
sector_t * fakesector = gl_FakeFlat(MissingLowerTextures[i].seg->frontsector, &fake, mDrawer->in_area, false); sector_t * fakesector = gl_FakeFlat(MissingLowerTextures[i].seg->frontsector, &fake, in_area, false);
float planez = (float)fakesector->GetPlaneTexZ(sector_t::floor); float planez = (float)fakesector->GetPlaneTexZ(sector_t::floor);
backsub->validcount = validcount; backsub->validcount = validcount;
if (DoFakeBridge(backsub, planez)) if (DoFakeBridge(backsub, planez, in_area))
{ {
// The mere fact that this seg has been added to the list means that the back sector // The mere fact that this seg has been added to the list means that the back sector
// will be rendered so we can safely assume that it is already in the render list // will be rendered so we can safely assume that it is already in the render list
@ -645,7 +645,7 @@ void FDrawInfo::HandleMissingTextures()
// //
//========================================================================== //==========================================================================
void FDrawInfo::DrawUnhandledMissingTextures() void HWDrawInfo::DrawUnhandledMissingTextures()
{ {
validcount++; validcount++;
for (int i = MissingUpperSegs.Size() - 1; i >= 0; i--) for (int i = MissingUpperSegs.Size() - 1; i >= 0; i--)
@ -714,7 +714,7 @@ ADD_STAT(missingtextures)
// //
//========================================================================== //==========================================================================
void FDrawInfo::AddHackedSubsector(subsector_t * sub) void HWDrawInfo::AddHackedSubsector(subsector_t * sub)
{ {
if (!(level.maptype == MAPTYPE_HEXEN)) if (!(level.maptype == MAPTYPE_HEXEN))
{ {
@ -729,7 +729,7 @@ void FDrawInfo::AddHackedSubsector(subsector_t * sub)
// //
//========================================================================== //==========================================================================
bool FDrawInfo::CheckAnchorFloor(subsector_t * sub) bool HWDrawInfo::CheckAnchorFloor(subsector_t * sub)
{ {
// This subsector has a one sided wall and can be used. // This subsector has a one sided wall and can be used.
if (sub->hacked==3) return true; if (sub->hacked==3) return true;
@ -768,7 +768,7 @@ bool FDrawInfo::CheckAnchorFloor(subsector_t * sub)
// //
//========================================================================== //==========================================================================
bool FDrawInfo::CollectSubsectorsFloor(subsector_t * sub, sector_t * anchor) bool HWDrawInfo::CollectSubsectorsFloor(subsector_t * sub, sector_t * anchor)
{ {
// mark it checked // mark it checked
@ -832,7 +832,7 @@ bool FDrawInfo::CollectSubsectorsFloor(subsector_t * sub, sector_t * anchor)
// //
//========================================================================== //==========================================================================
bool FDrawInfo::CheckAnchorCeiling(subsector_t * sub) bool HWDrawInfo::CheckAnchorCeiling(subsector_t * sub)
{ {
// This subsector has a one sided wall and can be used. // This subsector has a one sided wall and can be used.
if (sub->hacked==3) return true; if (sub->hacked==3) return true;
@ -871,7 +871,7 @@ bool FDrawInfo::CheckAnchorCeiling(subsector_t * sub)
// //
//========================================================================== //==========================================================================
bool FDrawInfo::CollectSubsectorsCeiling(subsector_t * sub, sector_t * anchor) bool HWDrawInfo::CollectSubsectorsCeiling(subsector_t * sub, sector_t * anchor)
{ {
// mark it checked // mark it checked
sub->validcount=validcount; sub->validcount=validcount;
@ -931,7 +931,7 @@ bool FDrawInfo::CollectSubsectorsCeiling(subsector_t * sub, sector_t * anchor)
// //
//========================================================================== //==========================================================================
void FDrawInfo::HandleHackedSubsectors() void HWDrawInfo::HandleHackedSubsectors()
{ {
lowershcount=uppershcount=0; lowershcount=uppershcount=0;
totalssms.Reset(); totalssms.Reset();
@ -959,13 +959,7 @@ void FDrawInfo::HandleHackedSubsectors()
node->sub = HandledSubsectors[j]; node->sub = HandledSubsectors[j];
AddOtherFloorPlane(sub->render_sector->sectornum, node); AddOtherFloorPlane(sub->render_sector->sectornum, node);
} }
if (inview) for(unsigned int j=0;j<lowersegs.Size();j++) if (inview) ProcessLowerMinisegs(lowersegs);
{
seg_t * seg=lowersegs[j];
GLWall wall(mDrawer);
wall.ProcessLowerMiniseg(seg, seg->Subsector->render_sector, seg->PartnerSeg->Subsector->render_sector);
rendered_lines++;
}
lowershcount+=HandledSubsectors.Size(); lowershcount+=HandledSubsectors.Size();
} }
} }
@ -1014,12 +1008,12 @@ ADD_STAT(sectorhacks)
// //
//========================================================================== //==========================================================================
void FDrawInfo::AddFloorStack(sector_t * sec) void HWDrawInfo::AddFloorStack(sector_t * sec)
{ {
FloorStacks.Push(sec); FloorStacks.Push(sec);
} }
void FDrawInfo::AddCeilingStack(sector_t * sec) void HWDrawInfo::AddCeilingStack(sector_t * sec)
{ {
CeilingStacks.Push(sec); CeilingStacks.Push(sec);
} }
@ -1030,7 +1024,7 @@ void FDrawInfo::AddCeilingStack(sector_t * sec)
// //
//========================================================================== //==========================================================================
void FDrawInfo::CollectSectorStacksCeiling(subsector_t * sub, sector_t * anchor) void HWDrawInfo::CollectSectorStacksCeiling(subsector_t * sub, sector_t * anchor, area_t in_area)
{ {
// mark it checked // mark it checked
sub->validcount=validcount; sub->validcount=validcount;
@ -1042,7 +1036,7 @@ void FDrawInfo::CollectSectorStacksCeiling(subsector_t * sub, sector_t * anchor)
if (sub->numlines>2 && !(ss_renderflags[sub->Index()]&SSRF_PROCESSED)) return; if (sub->numlines>2 && !(ss_renderflags[sub->Index()]&SSRF_PROCESSED)) return;
// Must be the exact same visplane // Must be the exact same visplane
sector_t * me = gl_FakeFlat(sub->render_sector, &fakesec, mDrawer->in_area, false); sector_t * me = gl_FakeFlat(sub->render_sector, &fakesec, in_area, false);
if (me->GetTexture(sector_t::ceiling) != anchor->GetTexture(sector_t::ceiling) || if (me->GetTexture(sector_t::ceiling) != anchor->GetTexture(sector_t::ceiling) ||
me->ceilingplane != anchor->ceilingplane || me->ceilingplane != anchor->ceilingplane ||
me->GetCeilingLight() != anchor->GetCeilingLight() || me->GetCeilingLight() != anchor->GetCeilingLight() ||
@ -1063,7 +1057,7 @@ void FDrawInfo::CollectSectorStacksCeiling(subsector_t * sub, sector_t * anchor)
{ {
subsector_t * backsub = seg->PartnerSeg->Subsector; subsector_t * backsub = seg->PartnerSeg->Subsector;
if (backsub->validcount!=validcount) CollectSectorStacksCeiling (backsub, anchor); if (backsub->validcount!=validcount) CollectSectorStacksCeiling (backsub, anchor, in_area);
} }
} }
} }
@ -1074,7 +1068,7 @@ void FDrawInfo::CollectSectorStacksCeiling(subsector_t * sub, sector_t * anchor)
// //
//========================================================================== //==========================================================================
void FDrawInfo::CollectSectorStacksFloor(subsector_t * sub, sector_t * anchor) void HWDrawInfo::CollectSectorStacksFloor(subsector_t * sub, sector_t * anchor, area_t in_area)
{ {
// mark it checked // mark it checked
sub->validcount=validcount; sub->validcount=validcount;
@ -1086,7 +1080,7 @@ void FDrawInfo::CollectSectorStacksFloor(subsector_t * sub, sector_t * anchor)
if (sub->numlines>2 && !(ss_renderflags[sub->Index()]&SSRF_PROCESSED)) return; if (sub->numlines>2 && !(ss_renderflags[sub->Index()]&SSRF_PROCESSED)) return;
// Must be the exact same visplane // Must be the exact same visplane
sector_t * me = gl_FakeFlat(sub->render_sector, &fakesec, mDrawer->in_area, false); sector_t * me = gl_FakeFlat(sub->render_sector, &fakesec, in_area, false);
if (me->GetTexture(sector_t::floor) != anchor->GetTexture(sector_t::floor) || if (me->GetTexture(sector_t::floor) != anchor->GetTexture(sector_t::floor) ||
me->floorplane != anchor->floorplane || me->floorplane != anchor->floorplane ||
me->GetFloorLight() != anchor->GetFloorLight() || me->GetFloorLight() != anchor->GetFloorLight() ||
@ -1107,7 +1101,7 @@ void FDrawInfo::CollectSectorStacksFloor(subsector_t * sub, sector_t * anchor)
{ {
subsector_t * backsub = seg->PartnerSeg->Subsector; subsector_t * backsub = seg->PartnerSeg->Subsector;
if (backsub->validcount!=validcount) CollectSectorStacksFloor (backsub, anchor); if (backsub->validcount!=validcount) CollectSectorStacksFloor (backsub, anchor, in_area);
} }
} }
} }
@ -1118,14 +1112,14 @@ void FDrawInfo::CollectSectorStacksFloor(subsector_t * sub, sector_t * anchor)
// //
//========================================================================== //==========================================================================
void FDrawInfo::ProcessSectorStacks() void HWDrawInfo::ProcessSectorStacks(area_t in_area)
{ {
unsigned int i; unsigned int i;
validcount++; validcount++;
for (i=0;i<CeilingStacks.Size (); i++) for (i=0;i<CeilingStacks.Size (); i++)
{ {
sector_t *sec = gl_FakeFlat(CeilingStacks[i], &fakesec, mDrawer->in_area, false); sector_t *sec = gl_FakeFlat(CeilingStacks[i], &fakesec, in_area, false);
auto portal = sec->GetPortalGroup(sector_t::ceiling); auto portal = sec->GetPortalGroup(sector_t::ceiling);
if (portal != NULL) for(int k=0;k<sec->subsectorcount;k++) if (portal != NULL) for(int k=0;k<sec->subsectorcount;k++)
{ {
@ -1140,7 +1134,7 @@ void FDrawInfo::ProcessSectorStacks()
{ {
subsector_t * backsub = seg->PartnerSeg->Subsector; subsector_t * backsub = seg->PartnerSeg->Subsector;
if (backsub->validcount!=validcount) CollectSectorStacksCeiling (backsub, sec); if (backsub->validcount!=validcount) CollectSectorStacksCeiling (backsub, sec, in_area);
} }
} }
for(unsigned int j=0;j<HandledSubsectors.Size();j++) for(unsigned int j=0;j<HandledSubsectors.Size();j++)
@ -1169,7 +1163,7 @@ void FDrawInfo::ProcessSectorStacks()
validcount++; validcount++;
for (i=0;i<FloorStacks.Size (); i++) for (i=0;i<FloorStacks.Size (); i++)
{ {
sector_t *sec = gl_FakeFlat(FloorStacks[i], &fakesec, mDrawer->in_area, false); sector_t *sec = gl_FakeFlat(FloorStacks[i], &fakesec, in_area, false);
auto portal = sec->GetPortalGroup(sector_t::floor); auto portal = sec->GetPortalGroup(sector_t::floor);
if (portal != NULL) for(int k=0;k<sec->subsectorcount;k++) if (portal != NULL) for(int k=0;k<sec->subsectorcount;k++)
{ {
@ -1184,7 +1178,7 @@ void FDrawInfo::ProcessSectorStacks()
{ {
subsector_t * backsub = seg->PartnerSeg->Subsector; subsector_t * backsub = seg->PartnerSeg->Subsector;
if (backsub->validcount!=validcount) CollectSectorStacksFloor (backsub, sec); if (backsub->validcount!=validcount) CollectSectorStacksFloor (backsub, sec, in_area);
} }
} }

View file

@ -269,9 +269,9 @@ void GLSceneDrawer::CreateScene()
// These cannot be multithreaded when the time comes because all these depend // These cannot be multithreaded when the time comes because all these depend
// on the global 'validcount' variable. // on the global 'validcount' variable.
gl_drawinfo->HandleMissingTextures(); // Missing upper/lower textures gl_drawinfo->HandleMissingTextures(in_area); // Missing upper/lower textures
gl_drawinfo->HandleHackedSubsectors(); // open sector hacks for deep water gl_drawinfo->HandleHackedSubsectors(); // open sector hacks for deep water
gl_drawinfo->ProcessSectorStacks(); // merge visplanes of sector stacks gl_drawinfo->ProcessSectorStacks(in_area); // merge visplanes of sector stacks
GLRenderer->mVBO->Unmap(); GLRenderer->mVBO->Unmap();
ProcessAll.Unclock(); ProcessAll.Unclock();