remove old code

add visible on mapface_t although it's unused
This commit is contained in:
Jonathan 2022-08-03 13:26:04 -04:00
parent ec62a0e8d0
commit c9eab719bc
3 changed files with 31 additions and 58 deletions

View File

@ -45,6 +45,7 @@ struct mapface_t
int texinfo = 0;
int linenum = 0;
bool bevel = false;
bool visible = false;
winding_t winding; // winding used to calculate bevels
surfflags_t flags{};

View File

@ -227,62 +227,6 @@ void FreeBrushes(mapentity_t *ent)
}
#endif
#if 0
/*
============
ExpandBrush
=============
*/
static void ExpandBrush(bspbrush_t &hullbrush, const aabb3d &hull_size)
{
int x, s;
qbsp_plane_t plane;
int cBevEdge = 0;
// create all the hull points
for (auto &f : facelist)
for (size_t i = 0; i < f.w.size(); i++) {
AddHullPoint(hullbrush, f.w[i], hull_size);
cBevEdge++;
}
// expand all of the planes
for (auto &mapface : hullbrush->faces) {
if (mapface.flags.no_expand)
continue;
qvec3d corner{};
for (x = 0; x < 3; x++) {
if (mapface.get_plane().get_normal()[x] > 0)
corner[x] = hull_size[1][x];
else if (mapface.get_plane().get_normal()[x] < 0)
corner[x] = hull_size[0][x];
}
qplane3d plane = mapface.get_plane();
plane.dist += qv::dot(corner, plane.normal);
mapface.planenum = map.add_or_find_plane(plane);
}
// add any axis planes not contained in the brush to bevel off corners
for (x = 0; x < 3; x++)
for (s = -1; s <= 1; s += 2) {
// add the plane
qvec3d normal = {};
normal[x] = (vec_t)s;
plane.set_normal(normal);
if (s == -1)
plane.get_dist() = -hullbrush->bounds.mins()[x] + -hull_size[0][x];
else
plane.get_dist() = hullbrush->bounds.maxs()[x] + hull_size[1][x];
AddBrushPlane(hullbrush, plane);
}
// add all of the edge bevels
for (auto &f : facelist)
for (size_t i = 0; i < f.w.size(); i++)
AddHullEdge(hullbrush, f.w[i], f.w[(i + 1) % f.w.size()], hull_size);
}
#endif
//============================================================================
contentflags_t Brush_GetContents(const mapbrush_t *mapbrush)
@ -625,8 +569,9 @@ static void Brush_LoadEntity(mapentity_t *dst, const mapentity_t *src, const int
}
qbsp_options.target_game->count_contents_in_stats(brush.contents, stats);
dst->brushes.push_back(std::make_unique<bspbrush_t>(std::move(brush)));
dst->bounds += brush.bounds;
dst->brushes.push_back(std::make_unique<bspbrush_t>(std::move(brush)));
}
logging::percent(src->mapbrushes.size(), src->mapbrushes.size(), src == map.world_entity());

View File

@ -2165,6 +2165,8 @@ inline void CalculateBrushBounds(mapbrush_t &ob)
ob.bounds = {};
for (size_t i = 0; i < ob.faces.size(); i++) {
ob.faces[i].visible = false;
const auto &plane = ob.faces[i].get_plane();
std::optional<winding_t> w = BaseWindingForPlane(plane);
@ -2181,7 +2183,7 @@ inline void CalculateBrushBounds(mapbrush_t &ob)
if (w) {
ob.faces[i].winding = w.value();
//side->visible = true;
ob.faces[i].visible = true;
for (auto &p : w.value()) {
ob.bounds += p;
}
@ -2290,6 +2292,31 @@ void ProcessMapBrushes()
num_offset++;
}
}
#if 0
// test expansion
for (auto &brush : entity.mapbrushes) {
for (auto &face : brush.faces) {
qvec3d corner{};
const qvec3d hull[] = {{ -16, -16, -24 }, { 16, 16, 32 }};
for (int32_t x = 0; x < 3; x++) {
if (face.get_plane().get_normal()[x] > 0) {
corner[x] = hull[1][x];
} else if (face.get_plane().get_normal()[x] < 0) {
corner[x] = hull[0][x];
}
}
qplane3d plane = face.get_plane();
plane.dist += qv::dot(corner, plane.normal);
face.planenum = map.add_or_find_plane(plane);
// ???
//face.bevel = false;
}
// re-calculate brush bounds/windings
CalculateBrushBounds(brush);
}
#endif
}
logging::print(logging::flag::STAT, " {:8} brushes\n", map.total_brushes);