diff --git a/qrenderdoc/Windows/BufferViewer.cpp b/qrenderdoc/Windows/BufferViewer.cpp index 408b38b87..d6c6f52aa 100644 --- a/qrenderdoc/Windows/BufferViewer.cpp +++ b/qrenderdoc/Windows/BufferViewer.cpp @@ -1628,6 +1628,9 @@ BufferViewer::BufferViewer(ICaptureContext &ctx, bool meshview, QWidget *parent) ui->vsoutData->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont)); ui->gsoutData->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont)); + ui->minBoundsLabel->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont)); + ui->maxBoundsLabel->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont)); + ui->rowOffset->setFont(Formatter::PreferredFont()); ui->instance->setFont(Formatter::PreferredFont()); ui->viewIndex->setFont(Formatter::PreferredFont()); @@ -1814,6 +1817,9 @@ void BufferViewer::SetupMeshView() ui->formatSpecifier->setVisible(false); ui->cameraControlsGroup->setVisible(false); + ui->minBoundsLabel->setText(lit("---")); + ui->maxBoundsLabel->setText(lit("---")); + ui->outputTabs->setWindowTitle(tr("Preview")); ui->dockarea->addToolWindow(ui->outputTabs, ToolWindowManager::EmptySpace); ui->dockarea->setToolWindowProperties(ui->outputTabs, ToolWindowManager::HideCloseButton); @@ -1861,6 +1867,7 @@ void BufferViewer::SetupMeshView() model->setSecondaryColumn(-1, m_Config.solidShadeMode == SolidShade::Secondary, false); UI_CalculateMeshFormats(); + on_resetCamera_clicked(); UpdateCurrentMeshConfig(); INVOKE_MEMFN(RT_UpdateAndDisplay); }); @@ -1870,6 +1877,7 @@ void BufferViewer::SetupMeshView() model->setPosColumn(m_ContextColumn); UI_CalculateMeshFormats(); + on_resetCamera_clicked(); UpdateCurrentMeshConfig(); INVOKE_MEMFN(RT_UpdateAndDisplay); }); @@ -2413,6 +2421,51 @@ void BufferViewer::UI_UpdateBoundingBox(const CalcBoundingBoxData &bbox) delete &bbox; } +void BufferViewer::UI_UpdateBoundingBoxLabels(int compCount) +{ + if(compCount == 0) + { + BufferItemModel *model = currentBufferModel(); + if(model) + { + int posEl = model->posColumn(); + if(posEl >= 0 && posEl < model->getConfig().columns.count()) + { + compCount = model->getConfig().columns[posEl].format.compCount; + } + } + } + + QString min, max; + + float *minData = &m_Config.minBounds.x; + float *maxData = &m_Config.maxBounds.x; + + const QString comps = lit("xyzw"); + + for(int i = 0; i < compCount && i < 4; i++) + { + if(i != 0) + { + min += lit("\n"); + max += lit("\n"); + } + + min += tr("Min %1: %2").arg(comps[i]).arg(Formatter::Format(minData[i])); + max += tr("Max %1: %2").arg(comps[i]).arg(Formatter::Format(maxData[i])); + } + + if(min.isEmpty()) + ui->minBoundsLabel->setText(lit("---")); + else + ui->minBoundsLabel->setText(min); + + if(max.isEmpty()) + ui->maxBoundsLabel->setText(lit("---")); + else + ui->maxBoundsLabel->setText(max); +} + void BufferViewer::UI_ResetArcball() { BBoxData bbox; @@ -2702,7 +2755,7 @@ void BufferViewer::UpdateCurrentMeshConfig() m_Config.showBBox = false; - if(model && !isCurrentRasterOut()) + if(model) { int posEl = model->posColumn(); if(posEl >= 0 && posEl < model->getConfig().columns.count() && @@ -2710,7 +2763,11 @@ void BufferViewer::UpdateCurrentMeshConfig() { m_Config.minBounds = bbox.bounds[stage].Min[posEl]; m_Config.maxBounds = bbox.bounds[stage].Max[posEl]; - m_Config.showBBox = true; + m_Config.showBBox = !isCurrentRasterOut(); + + int compCount = model->getConfig().columns[posEl].format.compCount; + + UI_UpdateBoundingBoxLabels(compCount); } } } @@ -3556,6 +3613,27 @@ void BufferViewer::on_toggleControls_toggled(bool checked) { ui->cameraControlsGroup->setVisible(checked); + // temporarily set minimum bounds to the longest float we could format, to ensure the minimum size + // we calculate below is as big as needs to be (sigh...). This is necessary because Qt doesn't + // properly propagate the minimum size up through the scroll area and instead sizes it down much + // smaller. + FloatVector prev = m_Config.minBounds; + + m_Config.minBounds.x = 1.0f; + m_Config.minBounds.y = 1.2345e-20f; + m_Config.minBounds.z = 123456.7890123456789f; + m_Config.minBounds.w = 1.2345e+20f; + + UI_UpdateBoundingBoxLabels(4); + + m_Config.minBounds = prev; + + ui->cameraControlsWidget->setMinimumSize(ui->cameraControlsWidget->minimumSizeHint()); + ui->cameraControlsScroll->setMinimumWidth(ui->cameraControlsWidget->minimumSizeHint().width() + + ui->cameraControlsScroll->verticalScrollBar()->width()); + + UI_UpdateBoundingBoxLabels(); + EnableCameraGuessControls(); } diff --git a/qrenderdoc/Windows/BufferViewer.h b/qrenderdoc/Windows/BufferViewer.h index 2f4f27d8c..70723db44 100644 --- a/qrenderdoc/Windows/BufferViewer.h +++ b/qrenderdoc/Windows/BufferViewer.h @@ -167,6 +167,7 @@ private: void populateBBox(PopulateBufferData *data); void calcBoundingData(CalcBoundingBoxData &bbox); void UI_UpdateBoundingBox(const CalcBoundingBoxData &bbox); + void UI_UpdateBoundingBoxLabels(int compCount = 0); void UI_ResetArcball(); diff --git a/qrenderdoc/Windows/BufferViewer.ui b/qrenderdoc/Windows/BufferViewer.ui index 864b0d74e..4eff3cf28 100644 --- a/qrenderdoc/Windows/BufferViewer.ui +++ b/qrenderdoc/Windows/BufferViewer.ui @@ -382,148 +382,237 @@ Camera Controls - - - - 1000000.000000000000000 - - - 10.000000000000000 - - - - - - - 100.000000000000000 - - - 0.010000000000000 - - - - - - - 0.000000000000000 - - - 10.000000000000000 - - - 0.010000000000000 - - - - - - - Far Plane: - - - + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + - - - 5 + + + + 1 + 0 + - - 0.000100000000000 + + QFrame::NoFrame - - 100.000000000000000 + + Qt::ScrollBarAlwaysOn - - 0.000100000000000 + + Qt::ScrollBarAlwaysOff - - 1.000000000000000 - - - - - - - Near Plane: - - - - - - - Aspect Ratio: - - - - - - - Persp. FOV: - - - - - - - Speed: - - - - - - - 2 - - - 2 - - - QComboBox::NoInsert - - + true - - - - - - Manually set auto-guessed values + + + + 0 + 0 + 181 + 253 + + + + + 1 + 0 + + + + + + + Far Plane: + + + + + + + Manually set auto-guessed values 0.0 to use automatic value - - - - - - - Matrix Type: - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - 1.000000000000000 - - - 180.000000000000000 - - - 90.000000000000000 - + + + + + + + 0.000000000000000 + + + 10.000000000000000 + + + 0.010000000000000 + + + + + + + 1.000000000000000 + + + 180.000000000000000 + + + 90.000000000000000 + + + + + + + Near Plane: + + + + + + + Speed: + + + + + + + Persp. FOV: + + + + + + + Qt::Horizontal + + + + + + + Aspect Ratio: + + + + + + + 1000000.000000000000000 + + + 10.000000000000000 + + + + + + + + 0 + 0 + + + + 5 + + + 0.000100000000000 + + + 100.000000000000000 + + + 0.000100000000000 + + + 1.000000000000000 + + + + + + + 2 + + + 2 + + + QComboBox::NoInsert + + + true + + + + + + + + + + + + + + Matrix Type: + + + + + + + 100.000000000000000 + + + 0.010000000000000 + + + + + + + Qt::Vertical + + + + 20 + 39 + + + + + + + + + + + + + + + Bounding Box: + + + + +