allow toggling BSPX loading
This commit is contained in:
parent
1c6a76e1f8
commit
da2e6936d1
|
|
@ -627,6 +627,17 @@ int bsputil_main(int argc, char **argv)
|
|||
ent.get_vector("origin", origin);
|
||||
origin *= scalar;
|
||||
ent.set("origin", fmt::format("{} {} {}", origin[0], origin[1], origin[2]));
|
||||
} else if (ent.has("lip")) {
|
||||
float lip = ent.get_float("lip");
|
||||
lip -= 2.0f;
|
||||
lip *= scalar;
|
||||
lip += 2.0f;
|
||||
ent.set("lip", fmt::format("{}", lip));
|
||||
} else if (ent.has("height")) {
|
||||
// FIXME: check this
|
||||
float height = ent.get_float("height");
|
||||
height *= scalar;
|
||||
ent.set("height", fmt::format("{}", height));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -596,11 +596,15 @@ void GLView::takeScreenshot(QString destPath, int w, int h)
|
|||
}
|
||||
|
||||
void GLView::renderBSP(const QString &file, const mbsp_t &bsp, const bspxentries_t &bspx,
|
||||
const std::vector<entdict_t> &entities, const full_atlas_t &lightmap, const settings::common_settings &settings)
|
||||
const std::vector<entdict_t> &entities, const full_atlas_t &lightmap, const settings::common_settings &settings,
|
||||
bool use_bspx_normals)
|
||||
{
|
||||
img::load_textures(&bsp, settings);
|
||||
|
||||
auto facenormals = BSPX_FaceNormals(bsp, bspx);
|
||||
std::optional<bspxfacenormals> facenormals;
|
||||
|
||||
if (use_bspx_normals)
|
||||
facenormals = BSPX_FaceNormals(bsp, bspx);
|
||||
|
||||
// NOTE: according to https://doc.qt.io/qt-6/qopenglwidget.html#resource-initialization-and-cleanup
|
||||
// we can only do this after `initializeGL()` has run once.
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ public:
|
|||
|
||||
void renderBSP(const QString &file, const mbsp_t &bsp, const bspxentries_t &bspx,
|
||||
const std::vector<entdict_t> &entities, const full_atlas_t &lightmap,
|
||||
const settings::common_settings &settings);
|
||||
const settings::common_settings &settings, bool use_bspx_normals);
|
||||
void setCamera(const qvec3d &origin, const qvec3d &fwd);
|
||||
void setLighmapOnly(bool lighmapOnly);
|
||||
void setFullbright(bool fullbright);
|
||||
|
|
|
|||
|
|
@ -153,6 +153,12 @@ void MainWindow::createPropertiesSidebar()
|
|||
|
||||
nearest = new QCheckBox(tr("Nearest Filter"));
|
||||
|
||||
bspx_decoupled_lm = new QCheckBox(tr("BSPX: Decoupled Lightmap"));
|
||||
bspx_decoupled_lm->setChecked(true);
|
||||
|
||||
bspx_normals = new QCheckBox(tr("BSPX: Face Normals"));
|
||||
bspx_normals->setChecked(true);
|
||||
|
||||
formLayout->addRow(tr("qbsp"), qbsp_options);
|
||||
formLayout->addRow(vis_checkbox, vis_options);
|
||||
formLayout->addRow(tr("light"), light_options);
|
||||
|
|
@ -161,6 +167,8 @@ void MainWindow::createPropertiesSidebar()
|
|||
formLayout->addRow(showtris);
|
||||
formLayout->addRow(keepposition);
|
||||
formLayout->addRow(nearest);
|
||||
formLayout->addRow(bspx_decoupled_lm);
|
||||
formLayout->addRow(bspx_normals);
|
||||
|
||||
lightstyles = new QVBoxLayout();
|
||||
|
||||
|
|
@ -580,9 +588,9 @@ void MainWindow::loadFileInternal(const QString &file, bool is_reload)
|
|||
auto ents = EntData_Parse(bsp);
|
||||
|
||||
// build lightmap atlas
|
||||
auto atlas = build_lightmap_atlas(bsp, m_bspdata.bspx.entries, false, true);
|
||||
auto atlas = build_lightmap_atlas(bsp, m_bspdata.bspx.entries, false, bspx_decoupled_lm->isChecked());
|
||||
|
||||
glView->renderBSP(file, bsp, m_bspdata.bspx.entries, ents, atlas, render_settings);
|
||||
glView->renderBSP(file, bsp, m_bspdata.bspx.entries, ents, atlas, render_settings, bspx_normals->isChecked());
|
||||
|
||||
if (!is_reload && !glView->getKeepOrigin()) {
|
||||
for (auto &ent : ents) {
|
||||
|
|
|
|||
|
|
@ -72,6 +72,8 @@ private:
|
|||
|
||||
QCheckBox *vis_checkbox = nullptr;
|
||||
QCheckBox *nearest = nullptr;
|
||||
QCheckBox *bspx_decoupled_lm = nullptr;
|
||||
QCheckBox *bspx_normals = nullptr;
|
||||
|
||||
QLineEdit *qbsp_options = nullptr;
|
||||
QLineEdit *vis_options = nullptr;
|
||||
|
|
|
|||
Loading…
Reference in New Issue