- don't use a full sector backup in the triangulator for comparing changes.

Instead use a smaller struct only containing the relevant data.
This commit is contained in:
Christoph Oelckers 2021-12-27 23:14:16 +01:00
parent fb53f32603
commit a15e5399fa
2 changed files with 31 additions and 6 deletions

View file

@ -379,11 +379,7 @@ bool SectionGeometry::ValidateSection(Section* section, int plane)
section->dirty &= ~EDirty::CeilingDirty; section->dirty &= ~EDirty::CeilingDirty;
} }
#ifdef SECTOR_HACKJOB compare->copy(sec);
memcpy(compare, sec, sizeof(*sec));
#else
*compare = *sec;
#endif
sdata.poscompare[plane] = sec->firstWall()->pos; sdata.poscompare[plane] = sec->firstWall()->pos;
sdata.poscompare2[plane] = sec->firstWall()->point2Wall()->pos; sdata.poscompare2[plane] = sec->firstWall()->point2Wall()->pos;
return false; return false;

View file

@ -23,12 +23,41 @@ enum GeomFlags
using SectionGeometryPlane = SectorGeometryPlane; using SectionGeometryPlane = SectorGeometryPlane;
struct sectortypelight
{
float ceilingxpan_;
float ceilingypan_;
float floorxpan_;
float floorypan_;
ESectorFlags ceilingstat;
ESectorFlags floorstat;
int16_t ceilingpicnum;
int16_t ceilingheinum;
int16_t floorpicnum;
int16_t floorheinum;
void copy(sectortype* sec)
{
ceilingxpan_ = sec->ceilingxpan_;
ceilingypan_ = sec->ceilingypan_;
floorxpan_ = sec->floorxpan_;
floorypan_ = sec->floorypan_;
ceilingstat = sec->ceilingstat;
floorstat = sec->floorstat;
ceilingheinum = sec->ceilingheinum;
floorheinum = sec->floorheinum;
ceilingpicnum = sec->ceilingpicnum;
floorpicnum = sec->floorpicnum;
}
};
struct SectionGeometryData struct SectionGeometryData
{ {
SectorGeometryPlane planes[2]; SectorGeometryPlane planes[2];
TArray<FVector2> meshVertices; // flat vertices. Stored separately so that plane changes won't require completely new triangulation. TArray<FVector2> meshVertices; // flat vertices. Stored separately so that plane changes won't require completely new triangulation.
TArray<int> meshIndices; TArray<int> meshIndices;
sectortype compare[2] = {}; sectortypelight compare[2] = {};
vec2_t poscompare[2] = {}; vec2_t poscompare[2] = {};
vec2_t poscompare2[2] = {}; vec2_t poscompare2[2] = {};
FVector3 normal[2]; FVector3 normal[2];