- hole filling subsectors must also be explicitly triangulated for the automap because they may be non-convex.

This commit is contained in:
Christoph Oelckers 2018-11-10 08:04:03 +01:00
commit cfe51f0c30
6 changed files with 62 additions and 25 deletions

View file

@ -53,12 +53,14 @@ static void CreateVerticesForSubsector(subsector_t *sub, VertexContainer &gen, i
using Point = std::pair<double, double>;
std::vector<std::vector<Point>> polygon;
std::vector<Point> *curPoly;
polygon.resize(1);
curPoly = &polygon.back();
curPoly->resize(sub->numlines);
for (unsigned i = 0; i < sub->numlines; i++)
{
polygon.resize(1);
curPoly = &polygon.back();
curPoly->push_back({ sub->firstline[i].v1->fX(), sub->firstline[i].v1->fY() });
(*curPoly)[i] = { sub->firstline[i].v1->fX(), sub->firstline[i].v1->fY() };
}
auto indices = mapbox::earcut(polygon);
for (auto vti : indices)