diff --git a/lightpreview/glview.cpp b/lightpreview/glview.cpp index a9458a8e..e42c37cb 100644 --- a/lightpreview/glview.cpp +++ b/lightpreview/glview.cpp @@ -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; diff --git a/lightpreview/glview.h b/lightpreview/glview.h index 9e1c6e1d..a2b6d98a 100644 --- a/lightpreview/glview.h +++ b/lightpreview/glview.h @@ -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); diff --git a/lightpreview/mainwindow.cpp b/lightpreview/mainwindow.cpp index d5422e3f..8fb6d0a2 100644 --- a/lightpreview/mainwindow.cpp +++ b/lightpreview/mainwindow.cpp @@ -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); });