mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 15:02:01 +00:00
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:
parent
45625399dc
commit
a803b3d393
5 changed files with 157 additions and 138 deletions
|
@ -234,13 +234,7 @@ public:
|
|||
static float GetZFar() { return 65536.f; }
|
||||
};
|
||||
|
||||
enum area_t
|
||||
{
|
||||
area_normal,
|
||||
area_below,
|
||||
area_above,
|
||||
area_default
|
||||
};
|
||||
enum area_t : int;
|
||||
|
||||
|
||||
// Global functions. Make them members of GLRenderer later?
|
||||
|
@ -257,4 +251,4 @@ struct TexFilter_s
|
|||
|
||||
extern FGLRenderer *GLRenderer;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -1307,3 +1307,15 @@ void FDrawInfo::FloodLowerGap(seg_t * seg)
|
|||
// Step3: Delete the stencil
|
||||
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++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,10 +18,10 @@ enum DrawListType
|
|||
GLDL_MASKEDFLATS,
|
||||
GLDL_MASKEDWALLSOFS,
|
||||
GLDL_MODELS,
|
||||
|
||||
|
||||
GLDL_TRANSLUCENT,
|
||||
GLDL_TRANSLUCENTBORDER,
|
||||
|
||||
|
||||
GLDL_TYPES,
|
||||
};
|
||||
|
||||
|
@ -31,16 +31,16 @@ enum DLDrawListType
|
|||
// These are organized so that the various multipass rendering modes have to be set as few times as possible
|
||||
GLLDL_WALLS_PLAIN, // dynamic lights on normal walls
|
||||
GLLDL_WALLS_MASKED, // dynamic lights on masked midtextures
|
||||
|
||||
|
||||
GLLDL_FLATS_PLAIN, // dynamic lights on normal flats
|
||||
GLLDL_FLATS_MASKED, // dynamic lights on masked flats
|
||||
|
||||
|
||||
GLLDL_WALLS_FOG, // lights on fogged walls
|
||||
GLLDL_WALLS_FOGMASKED, // lights on fogged masked midtextures
|
||||
|
||||
|
||||
GLLDL_FLATS_FOG, // lights on fogged walls
|
||||
GLLDL_FLATS_FOGMASKED, // lights on fogged masked midtextures
|
||||
|
||||
|
||||
GLLDL_TYPES,
|
||||
};
|
||||
|
||||
|
@ -52,7 +52,7 @@ enum Drawpasses
|
|||
GLPASS_PLAIN, // Main pass without dynamic lights
|
||||
GLPASS_DECALS, // Draws a decal
|
||||
GLPASS_TRANSLUCENT, // Draws translucent objects
|
||||
|
||||
|
||||
// these are only used with texture based dynamic lights
|
||||
GLPASS_BASE, // untextured base for dynamic lights
|
||||
GLPASS_BASE_MASKED, // same but with active texture
|
||||
|
@ -60,7 +60,7 @@ enum Drawpasses
|
|||
GLPASS_TEXONLY, // finishing texture pass
|
||||
GLPASS_LIGHTTEX_ADDITIVE, // lighttexture pass (additive)
|
||||
GLPASS_LIGHTTEX_FOGGY, // lighttexture pass on foggy surfaces (forces all lights to be additive)
|
||||
|
||||
|
||||
};
|
||||
|
||||
//==========================================================================
|
||||
|
@ -76,7 +76,7 @@ struct GLDrawItem
|
|||
{
|
||||
GLDrawItemType rendertype;
|
||||
int index;
|
||||
|
||||
|
||||
GLDrawItem(GLDrawItemType _rendertype,int _index) : rendertype(_rendertype),index(_index) {}
|
||||
};
|
||||
|
||||
|
@ -88,8 +88,8 @@ struct SortNode
|
|||
SortNode * left; // left side of this node
|
||||
SortNode * equal; // equal to this node
|
||||
SortNode * right; // right side of this node
|
||||
|
||||
|
||||
|
||||
|
||||
void UnlinkFromChain();
|
||||
void Link(SortNode * hook);
|
||||
void AddToEqual(SortNode * newnode);
|
||||
|
@ -105,14 +105,14 @@ struct SortNode
|
|||
|
||||
struct GLDrawList
|
||||
{
|
||||
//private:
|
||||
//private:
|
||||
TArray<GLWall*> walls;
|
||||
TArray<GLFlat*> flats;
|
||||
TArray<GLSprite*> sprites;
|
||||
TArray<GLDrawItem> drawitems;
|
||||
int SortNodeStart;
|
||||
SortNode * sorted;
|
||||
|
||||
|
||||
public:
|
||||
GLDrawList()
|
||||
{
|
||||
|
@ -120,25 +120,25 @@ public:
|
|||
SortNodeStart=-1;
|
||||
sorted=NULL;
|
||||
}
|
||||
|
||||
|
||||
~GLDrawList()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
|
||||
unsigned int Size()
|
||||
{
|
||||
return drawitems.Size();
|
||||
}
|
||||
|
||||
|
||||
GLWall *NewWall();
|
||||
GLFlat *NewFlat();
|
||||
GLSprite *NewSprite();
|
||||
void Reset();
|
||||
void SortWalls();
|
||||
void SortFlats();
|
||||
|
||||
|
||||
|
||||
|
||||
void MakeSortList();
|
||||
SortNode * FindSortPlane(SortNode * head);
|
||||
SortNode * FindSortWall(SortNode * head);
|
||||
|
@ -174,18 +174,23 @@ struct gl_subsectorrendernode
|
|||
subsector_t * sub;
|
||||
};
|
||||
|
||||
|
||||
struct FDrawInfo
|
||||
enum area_t : int
|
||||
{
|
||||
area_normal,
|
||||
area_below,
|
||||
area_above,
|
||||
area_default
|
||||
};
|
||||
|
||||
struct HWDrawInfo
|
||||
{
|
||||
virtual ~HWDrawInfo() {}
|
||||
|
||||
struct wallseg
|
||||
{
|
||||
float x1, y1, z1, x2, y2, z2;
|
||||
};
|
||||
|
||||
bool temporary;
|
||||
|
||||
|
||||
|
||||
|
||||
struct MissingTextureInfo
|
||||
{
|
||||
seg_t * seg;
|
||||
|
@ -193,93 +198,107 @@ struct FDrawInfo
|
|||
float Planez;
|
||||
float Planezfront;
|
||||
};
|
||||
|
||||
|
||||
struct MissingSegInfo
|
||||
{
|
||||
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
|
||||
{
|
||||
subsector_t * sub;
|
||||
uint8_t flags;
|
||||
};
|
||||
|
||||
GLSceneDrawer *mDrawer;
|
||||
|
||||
|
||||
TArray<MissingTextureInfo> MissingUpperTextures;
|
||||
TArray<MissingTextureInfo> MissingLowerTextures;
|
||||
|
||||
TArray<MissingSegInfo> MissingUpperSegs;
|
||||
TArray<MissingSegInfo> MissingLowerSegs;
|
||||
|
||||
TArray<SubsectorHackInfo> SubsectorHacks;
|
||||
|
||||
TArray<gl_subsectorrendernode*> otherfloorplanes;
|
||||
TArray<gl_subsectorrendernode*> otherceilingplanes;
|
||||
|
||||
TArray<sector_t *> CeilingStacks;
|
||||
TArray<sector_t *> FloorStacks;
|
||||
|
||||
TArray<subsector_t *> HandledSubsectors;
|
||||
|
||||
TArray<uint8_t> sectorrenderflags;
|
||||
TArray<uint8_t> ss_renderflags;
|
||||
TArray<uint8_t> no_renderflags;
|
||||
|
||||
TArray<MissingTextureInfo> MissingUpperTextures;
|
||||
TArray<MissingTextureInfo> MissingLowerTextures;
|
||||
|
||||
TArray<MissingSegInfo> MissingUpperSegs;
|
||||
TArray<MissingSegInfo> MissingLowerSegs;
|
||||
|
||||
TArray<SubsectorHackInfo> SubsectorHacks;
|
||||
|
||||
TArray<gl_subsectorrendernode*> otherfloorplanes;
|
||||
TArray<gl_subsectorrendernode*> otherceilingplanes;
|
||||
|
||||
TArray<sector_t *> CeilingStacks;
|
||||
TArray<sector_t *> FloorStacks;
|
||||
|
||||
TArray<subsector_t *> HandledSubsectors;
|
||||
|
||||
FDrawInfo * next;
|
||||
GLDrawList drawlists[GLDL_TYPES];
|
||||
GLDrawList *dldrawlists = NULL; // only gets allocated when needed.
|
||||
|
||||
FDrawInfo();
|
||||
~FDrawInfo();
|
||||
|
||||
|
||||
void ClearBuffers();
|
||||
|
||||
void AddWall(GLWall *wall);
|
||||
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 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);
|
||||
void CollectSectorStacksFloor(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();
|
||||
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();
|
||||
|
||||
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;
|
||||
GLDrawList drawlists[GLDL_TYPES];
|
||||
GLDrawList *dldrawlists = NULL; // only gets allocated when needed.
|
||||
|
||||
FDrawInfo();
|
||||
~FDrawInfo();
|
||||
|
||||
void AddWall(GLWall *wall);
|
||||
bool PutWallCompat(GLWall *wall, int passflag); // Legacy GL only.
|
||||
|
||||
|
||||
void StartScene();
|
||||
void SetupFloodStencil(wallseg * ws);
|
||||
void ClearFloodStencil(wallseg * ws);
|
||||
void DrawFloodedPlane(wallseg * ws, float planez, sector_t * sec, bool ceiling);
|
||||
void FloodUpperGap(seg_t * seg);
|
||||
void FloodLowerGap(seg_t * seg);
|
||||
|
||||
void FloodUpperGap(seg_t * seg) override;
|
||||
void FloodLowerGap(seg_t * seg) override;
|
||||
void ProcessLowerMinisegs(TArray<seg_t *> &lowersegs) override;
|
||||
|
||||
static void StartDrawInfo(GLSceneDrawer *drawer);
|
||||
static void EndDrawInfo();
|
||||
|
||||
|
||||
gl_subsectorrendernode * GetOtherFloorPlanes(unsigned int sector)
|
||||
{
|
||||
if (sector<otherfloorplanes.Size()) return otherfloorplanes[sector];
|
||||
else return NULL;
|
||||
}
|
||||
|
||||
|
||||
gl_subsectorrendernode * GetOtherCeilingPlanes(unsigned int sector)
|
||||
{
|
||||
if (sector<otherceilingplanes.Size()) return otherceilingplanes[sector];
|
||||
|
@ -290,9 +309,9 @@ struct FDrawInfo
|
|||
class FDrawInfoList
|
||||
{
|
||||
TDeletingArray<FDrawInfo *> mList;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
FDrawInfo *GetNew();
|
||||
void Release(FDrawInfo *);
|
||||
};
|
||||
|
@ -303,4 +322,4 @@ extern FDrawInfo * gl_drawinfo;
|
|||
void gl_SetPlaneTextureRotation(const GLSectorPlane * secplane, FMaterial * gltexture);
|
||||
void gl_SetRenderStyle(FRenderStyle style, bool drawopaque, bool allowcolorblending);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -55,7 +55,7 @@ static subsector_t * viewsubsector;
|
|||
static TArray<seg_t *> lowersegs;
|
||||
|
||||
|
||||
void FDrawInfo::ClearBuffers()
|
||||
void HWDrawInfo::ClearBuffers()
|
||||
{
|
||||
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();
|
||||
|
||||
|
@ -111,7 +111,7 @@ void FDrawInfo::AddOtherFloorPlane(int sector, gl_subsectorrendernode * node)
|
|||
otherfloorplanes[sector] = node;
|
||||
}
|
||||
|
||||
void FDrawInfo::AddOtherCeilingPlane(int sector, gl_subsectorrendernode * node)
|
||||
void HWDrawInfo::AddOtherCeilingPlane(int sector, gl_subsectorrendernode * node)
|
||||
{
|
||||
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
|
||||
//
|
||||
//==========================================================================
|
||||
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;
|
||||
|
||||
|
@ -186,7 +186,7 @@ void FDrawInfo::AddUpperMissingTexture(side_t * side, subsector_t *sub, float Ba
|
|||
// 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;
|
||||
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?
|
||||
// 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
|
||||
// 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
|
||||
if (sec->ceilingplane.isSlope()) return false;
|
||||
|
@ -304,7 +304,7 @@ bool FDrawInfo::DoOneSectorUpper(subsector_t * subsec, float Planez)
|
|||
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
|
||||
|
||||
|
@ -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?
|
||||
// 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
|
||||
// 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
|
||||
if (sec->floorplane.isSlope()) return false;
|
||||
|
@ -362,7 +362,7 @@ bool FDrawInfo::DoOneSectorLower(subsector_t * subsec, float Planez)
|
|||
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
|
||||
|
||||
|
@ -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?
|
||||
// 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
|
||||
// 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
|
||||
if (sec->floorplane.isSlope()) return false;
|
||||
|
@ -416,7 +416,7 @@ bool FDrawInfo::DoFakeBridge(subsector_t * subsec, float Planez)
|
|||
// No texture checks though!
|
||||
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
|
||||
|
||||
|
@ -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?
|
||||
// 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
|
||||
// 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
|
||||
if (sec->ceilingplane.isSlope()) return false;
|
||||
|
@ -469,7 +469,7 @@ bool FDrawInfo::DoFakeCeilingBridge(subsector_t * subsec, float Planez)
|
|||
// No texture checks though!
|
||||
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
|
||||
|
||||
|
@ -483,7 +483,7 @@ bool FDrawInfo::DoFakeCeilingBridge(subsector_t * subsec, float Planez)
|
|||
// Draws the fake planes
|
||||
//
|
||||
//==========================================================================
|
||||
void FDrawInfo::HandleMissingTextures()
|
||||
void HWDrawInfo::HandleMissingTextures(area_t in_area)
|
||||
{
|
||||
sector_t fake;
|
||||
totalms.Clock();
|
||||
|
@ -501,7 +501,7 @@ void FDrawInfo::HandleMissingTextures()
|
|||
// close the hole only if all neighboring sectors are an exact height match
|
||||
// Otherwise just fill in the missing textures.
|
||||
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;
|
||||
// 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
|
||||
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);
|
||||
|
||||
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
|
||||
// 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
|
||||
// Otherwise just fill in the missing textures.
|
||||
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;
|
||||
// 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
|
||||
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);
|
||||
|
||||
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
|
||||
// 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++;
|
||||
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))
|
||||
{
|
||||
|
@ -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.
|
||||
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
|
||||
|
@ -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.
|
||||
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
|
||||
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;
|
||||
totalssms.Reset();
|
||||
|
@ -959,13 +959,7 @@ void FDrawInfo::HandleHackedSubsectors()
|
|||
node->sub = HandledSubsectors[j];
|
||||
AddOtherFloorPlane(sub->render_sector->sectornum, node);
|
||||
}
|
||||
if (inview) 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++;
|
||||
}
|
||||
if (inview) ProcessLowerMinisegs(lowersegs);
|
||||
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);
|
||||
}
|
||||
|
||||
void FDrawInfo::AddCeilingStack(sector_t * sec)
|
||||
void HWDrawInfo::AddCeilingStack(sector_t * 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
|
||||
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;
|
||||
|
||||
// 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) ||
|
||||
me->ceilingplane != anchor->ceilingplane ||
|
||||
me->GetCeilingLight() != anchor->GetCeilingLight() ||
|
||||
|
@ -1063,7 +1057,7 @@ void FDrawInfo::CollectSectorStacksCeiling(subsector_t * sub, sector_t * anchor)
|
|||
{
|
||||
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
|
||||
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;
|
||||
|
||||
// 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) ||
|
||||
me->floorplane != anchor->floorplane ||
|
||||
me->GetFloorLight() != anchor->GetFloorLight() ||
|
||||
|
@ -1107,7 +1101,7 @@ void FDrawInfo::CollectSectorStacksFloor(subsector_t * sub, sector_t * anchor)
|
|||
{
|
||||
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;
|
||||
|
||||
validcount++;
|
||||
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);
|
||||
if (portal != NULL) for(int k=0;k<sec->subsectorcount;k++)
|
||||
{
|
||||
|
@ -1140,7 +1134,7 @@ void FDrawInfo::ProcessSectorStacks()
|
|||
{
|
||||
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++)
|
||||
|
@ -1169,7 +1163,7 @@ void FDrawInfo::ProcessSectorStacks()
|
|||
validcount++;
|
||||
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);
|
||||
if (portal != NULL) for(int k=0;k<sec->subsectorcount;k++)
|
||||
{
|
||||
|
@ -1184,7 +1178,7 @@ void FDrawInfo::ProcessSectorStacks()
|
|||
{
|
||||
subsector_t * backsub = seg->PartnerSeg->Subsector;
|
||||
|
||||
if (backsub->validcount!=validcount) CollectSectorStacksFloor (backsub, sec);
|
||||
if (backsub->validcount!=validcount) CollectSectorStacksFloor (backsub, sec, in_area);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -269,9 +269,9 @@ void GLSceneDrawer::CreateScene()
|
|||
// These cannot be multithreaded when the time comes because all these depend
|
||||
// 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->ProcessSectorStacks(); // merge visplanes of sector stacks
|
||||
gl_drawinfo->ProcessSectorStacks(in_area); // merge visplanes of sector stacks
|
||||
GLRenderer->mVBO->Unmap();
|
||||
|
||||
ProcessAll.Unclock();
|
||||
|
|
Loading…
Reference in a new issue