Progress incase power goes out
This commit is contained in:
parent
b867a0d631
commit
abd61d4d01
3 changed files with 408 additions and 3749 deletions
4128
Data/sandbox-log.txt
4128
Data/sandbox-log.txt
File diff suppressed because it is too large
Load diff
|
@ -6,7 +6,7 @@
|
|||
#include "KP3D_Log.h"
|
||||
|
||||
namespace {
|
||||
const float EPSILON = 1.0f / 128.0f;
|
||||
const float EPSILON = 4.0f / 128.0f;
|
||||
}
|
||||
|
||||
namespace kp3d {
|
||||
|
|
|
@ -19,6 +19,11 @@ bool SectorContains(const kp3d::Sector& outer, const kp3d::Sector& inner)
|
|||
using namespace Clipper2Lib;
|
||||
using namespace kp3d;
|
||||
|
||||
bool completely_inside = false;
|
||||
bool partially_inside = false;
|
||||
int count = 0;
|
||||
int partial_count = 0;
|
||||
|
||||
PathD outer_path;
|
||||
for (const Wall& l: outer.walls)
|
||||
outer_path.push_back({l.start.x, l.start.y});
|
||||
|
@ -27,10 +32,6 @@ bool SectorContains(const kp3d::Sector& outer, const kp3d::Sector& inner)
|
|||
for (const Wall& l: inner.walls)
|
||||
inner_path.push_back({l.start.x, l.start.y});
|
||||
|
||||
bool completely_inside = false;
|
||||
bool partially_inside = false;
|
||||
int count = 0;
|
||||
int partial_count = 0;
|
||||
for (PointD& p: inner_path)
|
||||
{
|
||||
PointInPolygonResult status = Clipper2Lib::PointInPolygon(p, outer_path);
|
||||
|
@ -216,8 +217,8 @@ void Map::BuildQuad(Sector& sector, Wall& wall, Flat& flat_top, Flat& flat_botto
|
|||
if (!points.empty())
|
||||
if (!FloatCmp(points.back().x, Distance({ pos_a.x, pos_a.y }, {pos_b.x, pos_b.y})))
|
||||
points.push_back({ Distance({ pos_a.x, pos_a.y }, {pos_b.x, pos_b.y}), flat_bottom.base_height});
|
||||
if (points.empty())
|
||||
points.push_back({ 0.0f, flat_bottom.base_height});
|
||||
// if (points.empty())
|
||||
// points.push_back({ 0.0f, flat_bottom.base_height});
|
||||
std::vector<Vec2> top_points;
|
||||
for (const Vertex3D& v: flat_top.triangulated_data)
|
||||
{
|
||||
|
@ -229,8 +230,8 @@ void Map::BuildQuad(Sector& sector, Wall& wall, Flat& flat_top, Flat& flat_botto
|
|||
if (!top_points.empty())
|
||||
if (!FloatCmp(top_points.back().x, 0.0f))
|
||||
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});
|
||||
// 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; });
|
||||
std::sort(top_points.begin(), top_points.end(), [&](Vec2 a, Vec2 b) { return a.x > b.x; });
|
||||
points.insert(points.end(), top_points.begin(), top_points.end());
|
||||
|
@ -306,7 +307,6 @@ void Map::BuildWall(Sector& sector, Wall& wall)
|
|||
{
|
||||
if (!(wall.flags & Wall::FLAG_JOINED))
|
||||
{
|
||||
KP3D_LOG_INFO("POOP J: {}", sector.id);
|
||||
bool flip = wall.portal->floor.base_height < sector.floor.base_height;
|
||||
BuildQuad(sector, wall, sector.floor, wall.portal->floor, wall.textures[TEX_LOWER], a, b, flip, false, false, wall.uv_offset[TEX_LOWER]);
|
||||
flip = wall.portal->ceiling.base_height < sector.ceiling.base_height;
|
||||
|
@ -650,6 +650,7 @@ void Map::Rebuild(NormalGenType gen_normals)
|
|||
if (SectorContains(potential_parent, sector))
|
||||
{
|
||||
potential_parent.children.push_back(§or);
|
||||
sector.flags |= Sector::FLAG_SUBSECTOR;
|
||||
sector.parent_id = potential_parent.id;
|
||||
break;
|
||||
}
|
||||
|
@ -704,10 +705,10 @@ void Map::Rebuild(NormalGenType gen_normals)
|
|||
|
||||
//if (s.id == 1 || s.id == 5)
|
||||
{
|
||||
float yv0 = PerlinNoise2D(steiner_point.x, steiner_point.y, 1.0, 10.0);
|
||||
float yv1 = -PerlinNoise2D(steiner_point.x, steiner_point.y, 0.5, 9.0);
|
||||
s.floor.steiner_points.push_back({ steiner_point.x, yv0, steiner_point.y });
|
||||
s.ceiling.steiner_points.push_back({ steiner_point.x, yv1, steiner_point.y });
|
||||
//float yv0 = PerlinNoise2D(steiner_point.x, steiner_point.y, 1.0, 10.0);
|
||||
//float yv1 = -PerlinNoise2D(steiner_point.x, steiner_point.y, 0.5, 9.0);
|
||||
//s.floor.steiner_points.push_back({ steiner_point.x, yv0, steiner_point.y });
|
||||
//s.ceiling.steiner_points.push_back({ steiner_point.x, yv1, steiner_point.y });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue