- store plane meshes without height information.

This avoids retriangulation when just the plane's z changes.
This commit is contained in:
Christoph Oelckers 2021-03-30 20:30:35 +02:00
parent 6239734bdc
commit 9cccd6f89b
2 changed files with 6 additions and 3 deletions

View file

@ -105,11 +105,12 @@ void HWFlat::MakeVertices()
if (!mesh) return;
auto ret = screen->mVertexData->AllocVertices(mesh->vertices.Size());
auto vp = ret.first;
float base = (plane == 0 ? sec->floorz : sec->ceilingz) * (1/-256.f);
for (unsigned i = 0; i < mesh->vertices.Size(); i++)
{
auto& pt = mesh->vertices[i];
auto& uv = mesh->texcoords[i];
vp->SetVertex(pt.X, pt.Z, pt.Y);
vp->SetVertex(pt.X, base + pt.Z, pt.Y);
vp->SetTexCoord(uv.X, canvas? 1.f - uv.Y : uv.Y);
vp++;
}

View file

@ -263,9 +263,13 @@ void SectorGeometry::MakeVertices(unsigned int secnum, int plane)
for (auto& pt : polygon[a])
{
float planez;
int fz = sec->floorz, cz = sec->ceilingz;
sec->floorz = sec->ceilingz = 0;
PlanesAtPoint(sec, (pt.first * 16), (pt.second * -16), plane ? &planez : nullptr, !plane ? &planez : nullptr);
FVector3 point = { pt.first, pt.second, planez };
points[p++] = point;
sec->floorz = fz;
sec->ceilingz = cz;
}
}
@ -303,7 +307,6 @@ void SectorGeometry::ValidateSector(unsigned int secnum, int plane)
((sec->floorstat ^ compare->floorstat) & (CSTAT_SECTOR_ALIGN | CSTAT_SECTOR_YFLIP | CSTAT_SECTOR_XFLIP | CSTAT_SECTOR_TEXHALF | CSTAT_SECTOR_SWAPXY)) == 0 &&
sec->floorxpan_ == compare->floorxpan_ &&
sec->floorypan_ == compare->floorypan_ &&
sec->floorz == compare->floorz &&
wall[sec->wallptr].pos == data[secnum].poscompare &&
wall[wall[sec->wallptr].point2].pos == data[secnum].poscompare2 &&
!(sec->dirty & 1) && data[secnum].planes[plane].vertices.Size() ) return;
@ -317,7 +320,6 @@ void SectorGeometry::ValidateSector(unsigned int secnum, int plane)
((sec->ceilingstat ^ compare->ceilingstat) & (CSTAT_SECTOR_ALIGN | CSTAT_SECTOR_YFLIP | CSTAT_SECTOR_XFLIP | CSTAT_SECTOR_TEXHALF | CSTAT_SECTOR_SWAPXY)) == 0 &&
sec->ceilingxpan_ == compare->ceilingxpan_ &&
sec->ceilingypan_ == compare->ceilingypan_ &&
sec->ceilingz == compare->ceilingz &&
wall[sec->wallptr].pos == data[secnum].poscompare &&
wall[wall[sec->wallptr].point2].pos == data[secnum].poscompare2 &&
!(sec->dirty & 2) && data[secnum].planes[plane].vertices.Size()) return;