Subsectors can now be properly joined
This commit is contained in:
parent
c4620539e1
commit
2f6a6fcbfe
2 changed files with 1005 additions and 121 deletions
1086
Data/sandbox-log.txt
1086
Data/sandbox-log.txt
File diff suppressed because it is too large
Load diff
|
@ -125,10 +125,14 @@ void Map::BuildFlat(Sector& sector, Flat& flat, bool invert)
|
|||
l.textures[TEX_FRONT] = nullptr;
|
||||
l.flags = Wall::FLAG_OPENING | Wall::FLAG_SUBSECTOR_OPENING;
|
||||
l.portal = §or;
|
||||
steiner_points.push_back({ l.start.x, l.start.y });
|
||||
// flat.steiner_points.push_back({ l.start.x, flat.base_height, l.start.y });
|
||||
//s->floor.steiner_points.push_back({ l.start.x, s->floor.base_height, l.start.y });
|
||||
//s->ceiling.steiner_points.push_back({ l.start.x, s->ceiling.base_height, l.start.y });
|
||||
}
|
||||
if (l.flags & Wall::FLAG_SUBSECTOR_OPENING)
|
||||
{
|
||||
steiner_points.push_back({ l.start.x, l.start.y });
|
||||
}
|
||||
}
|
||||
ss.push_back({l.start.x, l.start.y});
|
||||
}
|
||||
|
@ -214,6 +218,10 @@ void Map::BuildQuad(Sector& sector, Wall& wall, Flat& flat_top, Flat& flat_botto
|
|||
if (sector.inverted)
|
||||
flip ^= 1;
|
||||
|
||||
// Debug: remove all triangulated data (no terrain/slope support)
|
||||
//flat_top.triangulated_data.clear();
|
||||
//flat_bottom.triangulated_data.clear();
|
||||
|
||||
std::vector<Vec2> points;
|
||||
for (const Vertex3D& v: flat_bottom.triangulated_data)
|
||||
{
|
||||
|
@ -222,9 +230,16 @@ void Map::BuildQuad(Sector& sector, Wall& wall, Flat& flat_top, Flat& flat_botto
|
|||
Vec2 mpos = {Distance({v.position.x, v.position.z}, {pos_a.x, pos_a.z}), v.position.y};
|
||||
points.push_back(mpos);
|
||||
}
|
||||
// if (!points.empty())
|
||||
if (!FloatCmp(points.back().x, Distance({ pos_a.x, pos_a.z }, {pos_b.x, pos_b.z}), E))
|
||||
if (!points.empty())
|
||||
{
|
||||
//if (!FloatCmp(points.back().x, Distance({ pos_a.x, pos_a.z }, { pos_b.x, pos_b.z }), E) && !FloatCmp(points.back().y, flat_bottom.base_height, E))
|
||||
// points.push_back({ Distance({ pos_a.x, pos_a.z }, {pos_b.x, pos_b.z}), flat_bottom.base_height });
|
||||
}
|
||||
else
|
||||
{
|
||||
points.push_back({0.0f, flat_bottom.base_height});
|
||||
points.push_back({Distance({pos_a.x, pos_a.z}, {pos_b.x, pos_b.z}), flat_bottom.base_height});
|
||||
}
|
||||
//if (points.empty())
|
||||
// points.push_back({ 0.0f, flat_bottom.base_height });
|
||||
std::vector<Vec2> top_points;
|
||||
|
@ -235,9 +250,16 @@ void Map::BuildQuad(Sector& sector, Wall& wall, Flat& flat_top, Flat& flat_botto
|
|||
Vec2 mpos = {Distance({v.position.x, v.position.z}, {pos_a.x, pos_a.z}), v.position.y};
|
||||
top_points.push_back(mpos);
|
||||
}
|
||||
// if (!top_points.empty())
|
||||
if (!FloatCmp(top_points.back().x, 0.0f, E))
|
||||
if (!top_points.empty())
|
||||
{
|
||||
//if (!FloatCmp(top_points.back().x, 0.0f, E) && !FloatCmp(top_points.back().y, flat_top.base_height, E))
|
||||
// top_points.push_back({ 0.0f, flat_top.base_height });
|
||||
}
|
||||
else
|
||||
{
|
||||
top_points.push_back({ Distance({pos_a.x, pos_a.z}, {pos_b.x, pos_b.z}), flat_top.base_height });
|
||||
top_points.push_back({ 0.0f, flat_top.base_height });
|
||||
}
|
||||
// if (top_points.empty())
|
||||
// top_points.push_back({Distance({0.0f, 0.0f}, {pos_b.x - pos_a.x, pos_b.z - pos_a.x}), flat_top.base_height});
|
||||
std::sort(points.begin(), points.end(), [&](Vec2 a, Vec2 b) { return a.x < b.x; });
|
||||
|
|
Loading…
Reference in a new issue