From a15e5399fa5227224b022ee20a053eeca715e50a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 27 Dec 2021 23:14:16 +0100 Subject: [PATCH] - don't use a full sector backup in the triangulator for comparing changes. Instead use a smaller struct only containing the relevant data. --- source/core/sectorgeometry.cpp | 6 +----- source/core/sectorgeometry.h | 31 ++++++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/source/core/sectorgeometry.cpp b/source/core/sectorgeometry.cpp index 28def5e2a..20aa82271 100644 --- a/source/core/sectorgeometry.cpp +++ b/source/core/sectorgeometry.cpp @@ -379,11 +379,7 @@ bool SectionGeometry::ValidateSection(Section* section, int plane) section->dirty &= ~EDirty::CeilingDirty; } -#ifdef SECTOR_HACKJOB - memcpy(compare, sec, sizeof(*sec)); -#else - *compare = *sec; -#endif + compare->copy(sec); sdata.poscompare[plane] = sec->firstWall()->pos; sdata.poscompare2[plane] = sec->firstWall()->point2Wall()->pos; return false; diff --git a/source/core/sectorgeometry.h b/source/core/sectorgeometry.h index 269b94bfa..a1afb18b1 100644 --- a/source/core/sectorgeometry.h +++ b/source/core/sectorgeometry.h @@ -23,12 +23,41 @@ enum GeomFlags 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 { SectorGeometryPlane planes[2]; TArray meshVertices; // flat vertices. Stored separately so that plane changes won't require completely new triangulation. TArray meshIndices; - sectortype compare[2] = {}; + sectortypelight compare[2] = {}; vec2_t poscompare[2] = {}; vec2_t poscompare2[2] = {}; FVector3 normal[2];