add a switch to optimize compiles for no software mode (mainly for Q2)

fix tjunc 3 vert faces being destroyed
This commit is contained in:
Jonathan 2022-07-19 08:41:59 -04:00
parent b6153e3084
commit 989788cf71
4 changed files with 17 additions and 8 deletions

View File

@ -200,6 +200,8 @@ public:
setting_bool bsp2{this, "bsp2", false, &game_target_group, "target Quake's extended BSP2 format"};
setting_bool bsp2rmq{
this, "2psb", false, &game_target_group, "target Quake's extended 2PSB format (RMQ compatible)"};
setting_func nosubdivide{this, "nosubdivide", [&](source src) { subdivide.setValue(0, src); }, &common_format_group, "disable subdivision"};
setting_invertible_bool software{this, "software", true, &common_format_group, "change settings to allow for (or make adjustments to optimize for the lack of) software support"};
setting_int32 subdivide{this, "subdivide", 240, &common_format_group,
"change the subdivide threshold, in luxels. 0 will disable subdivision entirely"};
setting_bool nofill{this, "nofill", false, &debugging_group, "don't perform outside filling"};

View File

@ -494,10 +494,6 @@ static std::unique_ptr<face_t> FaceFromPortal(portal_t *p, int pside)
qbsp_options.target_game->directional_visible_contents(p->nodes[pside]->contents, p->nodes[!pside]->contents);
if (!make_face) {
// content type / game rules requested to skip generating a face on this side
// todo-brushbsp: remove when appropriate
logging::print("skipped face for {} -> {} portal\n",
p->nodes[pside]->contents.to_string(qbsp_options.target_game),
p->nodes[!pside]->contents.to_string(qbsp_options.target_game));
return nullptr;
}

View File

@ -236,13 +236,13 @@ void qbsp_settings::postinitialize(int argc, const char **argv)
// side effects from q2rtx
if (q2rtx.value()) {
if (!subdivide.isChanged()) {
subdivide.setValue(0, settings::source::GAME_TARGET);
}
if (!includeskip.isChanged()) {
includeskip.setValue(true, settings::source::GAME_TARGET);
}
if (!software.isChanged()) {
software.setValue(false, settings::source::GAME_TARGET);
}
}
// side effects from Quake II
@ -250,6 +250,10 @@ void qbsp_settings::postinitialize(int argc, const char **argv)
if (!maxedges.isChanged()) {
maxedges.setValue(0, settings::source::GAME_TARGET);
}
if (!software.value() && !subdivide.isChanged()) {
subdivide.setValue(0, settings::source::GAME_TARGET);
}
}
// load texture defs

View File

@ -507,6 +507,7 @@ static void FixFaceEdges(node_t *headnode, face_t *f, tjunc_stats_t &stats)
return;
} else if (superface.size() == 3) {
// no need to adjust this either
f->fragments.emplace_back(face_fragment_t { f->original_vertices });
return;
}
@ -591,7 +592,9 @@ static void FixFaceEdges(node_t *headnode, face_t *f, tjunc_stats_t &stats)
// split giant superfaces into subfaces if we have an edge limit.
if (qbsp_options.maxedges.value()) {
for (auto &face : faces) {
Q_assert(face.size() >= 3);
SplitFaceIntoFragments(face, faces, stats);
Q_assert(face.size() >= 3);
}
}
@ -601,6 +604,10 @@ static void FixFaceEdges(node_t *headnode, face_t *f, tjunc_stats_t &stats)
for (auto &face : faces) {
f->fragments.emplace_back(face_fragment_t { std::move(face) });
}
for (auto &frag : f->fragments) {
Q_assert(frag.output_vertices.size() >= 3);
}
}
#include <common/parallel.hh>