mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-14 20:00:49 +00:00
- fixed sector mesh generator to allow sectors with non-continuous wall loops.
Blood has a few such sectors.
This commit is contained in:
parent
4cc0afe587
commit
3c4429f2a8
1 changed files with 25 additions and 12 deletions
|
@ -224,26 +224,39 @@ void SectorGeometry::MakeVertices(unsigned int secnum, int plane)
|
||||||
|
|
||||||
polygon.resize(1);
|
polygon.resize(1);
|
||||||
curPoly = &polygon.back();
|
curPoly = &polygon.back();
|
||||||
|
FixedBitArray<MAXWALLSB> done;
|
||||||
|
|
||||||
int fz = sec->floorz, cz = sec->ceilingz;
|
int fz = sec->floorz, cz = sec->ceilingz;
|
||||||
sec->floorz = sec->ceilingz = 0;
|
sec->floorz = sec->ceilingz = 0;
|
||||||
|
|
||||||
for (int i = 0; i < numvertices; i++)
|
int vertstoadd = numvertices;
|
||||||
{
|
|
||||||
auto wal = &wall[sec->wallptr + i];
|
|
||||||
|
|
||||||
float X = WallStartX(wal);
|
done.Zero();
|
||||||
float Y = WallStartY(wal);
|
while (vertstoadd > 0)
|
||||||
if (fabs(X) > 32768. || fabs(Y) > 32768.)
|
{
|
||||||
{
|
int start = 0;
|
||||||
// If we get here there's some fuckery going around with the coordinates. Let's better abort and wait for things to realign.
|
while (done[start] && start < numvertices) start++;
|
||||||
return;
|
int s = start;
|
||||||
}
|
if (start < numvertices)
|
||||||
curPoly->push_back(std::make_pair(X, Y));
|
|
||||||
if (wal->point2 != sec->wallptr+i+1 && i < numvertices - 1)
|
|
||||||
{
|
{
|
||||||
|
while (!done[start])
|
||||||
|
{
|
||||||
|
auto wallp = &wall[sec->wallptr + start];
|
||||||
|
float X = WallStartX(wallp);
|
||||||
|
float Y = WallStartY(wallp);
|
||||||
|
if (fabs(X) > 32768. || fabs(Y) > 32768.)
|
||||||
|
{
|
||||||
|
// If we get here there's some fuckery going around with the coordinates. Let's better abort and wait for things to realign.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
curPoly->push_back(std::make_pair(X, Y));
|
||||||
|
done.Set(start);
|
||||||
|
vertstoadd--;
|
||||||
|
start = wallp->point2 - sec->wallptr;
|
||||||
|
}
|
||||||
polygon.resize(polygon.size() + 1);
|
polygon.resize(polygon.size() + 1);
|
||||||
curPoly = &polygon.back();
|
curPoly = &polygon.back();
|
||||||
|
assert(start == s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Now make sure that the outer boundary is the first polygon by picking a point that's as much to the outside as possible.
|
// Now make sure that the outer boundary is the first polygon by picking a point that's as much to the outside as possible.
|
||||||
|
|
Loading…
Reference in a new issue