lightpreview: add vis culling checkbox

This commit is contained in:
Eric Wasylishen 2023-07-30 11:26:59 -06:00
parent edb664f200
commit 7b83aa5976
3 changed files with 17 additions and 1 deletions

View File

@ -356,6 +356,10 @@ void GLView::updateFaceVisibility()
int leafnum = leaf - bsp.dleafs.data();
int clusternum = leaf->cluster;
if (!m_visCulling) {
clusternum = -1;
}
if (m_lastLeaf == clusternum) {
qDebug() << "reusing last frame visdata for leaf " << leafnum << " cluster " << clusternum;
return;
@ -367,7 +371,7 @@ void GLView::updateFaceVisibility()
if (it == m_decompressedVis.end()) {
qDebug() << "no visdata, must be in void";
m_lastLeaf = clusternum;
m_lastLeaf = -1;
setFaceVisibilityToAllVisible();
return;
@ -761,6 +765,12 @@ void GLView::setShowTrisSeeThrough(bool showtris)
update();
}
void GLView::setVisCulling(bool viscull)
{
m_visCulling = viscull;
update();
}
void GLView::setDrawFlat(bool drawflat)
{
m_drawFlat = drawflat;

View File

@ -72,6 +72,7 @@ private:
* -1 indicates solid leaf or no visdata (render all)
*/
int m_lastLeaf = -1;
bool m_visCulling = true;
// camera stuff
float m_displayAspect;
@ -197,6 +198,7 @@ public:
void setDrawNormals(bool drawnormals);
void setShowTris(bool showtris);
void setShowTrisSeeThrough(bool showtris);
void setVisCulling(bool viscull);
void setDrawFlat(bool drawflat);
void setKeepOrigin(bool keeporigin);
void setDrawPortals(bool drawportals);

View File

@ -173,6 +173,8 @@ void MainWindow::createPropertiesSidebar()
auto *showtris = new QCheckBox(tr("Show Tris"));
auto *showtris_seethrough = new QCheckBox(tr("Show Tris (See Through)"));
auto *visculling = new QCheckBox(tr("Vis Culling"));
visculling->setChecked(true);
auto *keepposition = new QCheckBox(tr("Keep Camera Pos"));
@ -193,6 +195,7 @@ void MainWindow::createPropertiesSidebar()
formLayout->addRow(drawleak);
formLayout->addRow(showtris);
formLayout->addRow(showtris_seethrough);
formLayout->addRow(visculling);
formLayout->addRow(keepposition);
formLayout->addRow(nearest);
formLayout->addRow(bspx_decoupled_lm);
@ -240,6 +243,7 @@ void MainWindow::createPropertiesSidebar()
connect(showtris, &QAbstractButton::toggled, this, [=](bool checked) { glView->setShowTris(checked); });
connect(showtris_seethrough, &QAbstractButton::toggled, this,
[=](bool checked) { glView->setShowTrisSeeThrough(checked); });
connect(visculling, &QAbstractButton::toggled, this, [=](bool checked) { glView->setVisCulling(checked); });
connect(drawflat, &QAbstractButton::toggled, this, [=](bool checked) { glView->setDrawFlat(checked); });
connect(drawportals, &QAbstractButton::toggled, this, [=](bool checked) { glView->setDrawPortals(checked); });
connect(drawleak, &QAbstractButton::toggled, this, [=](bool checked) { glView->setDrawLeak(checked); });