mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-28 01:16:31 +00:00
Display bounding box data in mesh view camera panel
* This isn't the best place for it but it makes the most sense for now.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
+223
-134
@@ -382,148 +382,237 @@
|
||||
<string>Camera Controls</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="6" column="1">
|
||||
<widget class="QDoubleSpinBox" name="farGuess">
|
||||
<property name="maximum">
|
||||
<double>1000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>10.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QDoubleSpinBox" name="nearGuess">
|
||||
<property name="maximum">
|
||||
<double>100.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.010000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QDoubleSpinBox" name="aspectGuess">
|
||||
<property name="minimum">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>10.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.010000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="farGuessLabel">
|
||||
<property name="text">
|
||||
<string>Far Plane:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<widget class="QDoubleSpinBox" name="camSpeed">
|
||||
<property name="decimals">
|
||||
<number>5</number>
|
||||
<widget class="QScrollArea" name="cameraControlsScroll">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>0.000100000000000</double>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>100.000000000000000</double>
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOn</enum>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.000100000000000</double>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="nearGuessLabel">
|
||||
<property name="text">
|
||||
<string>Near Plane:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="aspectGuessLabel">
|
||||
<property name="text">
|
||||
<string>Aspect Ratio:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="fovGuessLabel">
|
||||
<property name="text">
|
||||
<string>Persp. FOV:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="camSpeedLabel">
|
||||
<property name="text">
|
||||
<string>Speed:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="matrixType">
|
||||
<property name="maxVisibleItems">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="maxCount">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="insertPolicy">
|
||||
<enum>QComboBox::NoInsert</enum>
|
||||
</property>
|
||||
<property name="frame">
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QLabel" name="guessInstructions">
|
||||
<property name="text">
|
||||
<string>Manually set auto-guessed values
|
||||
<widget class="QWidget" name="cameraControlsWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>181</width>
|
||||
<height>253</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="farGuessLabel">
|
||||
<property name="text">
|
||||
<string>Far Plane:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QLabel" name="guessInstructions">
|
||||
<property name="text">
|
||||
<string>Manually set auto-guessed values
|
||||
0.0 to use automatic value</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="matrixTypeLabel">
|
||||
<property name="text">
|
||||
<string>Matrix Type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QDoubleSpinBox" name="fovGuess">
|
||||
<property name="minimum">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>180.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>90.000000000000000</double>
|
||||
</property>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QDoubleSpinBox" name="aspectGuess">
|
||||
<property name="minimum">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>10.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.010000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QDoubleSpinBox" name="fovGuess">
|
||||
<property name="minimum">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>180.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>90.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="nearGuessLabel">
|
||||
<property name="text">
|
||||
<string>Near Plane:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="camSpeedLabel">
|
||||
<property name="text">
|
||||
<string>Speed:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="fovGuessLabel">
|
||||
<property name="text">
|
||||
<string>Persp. FOV:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="aspectGuessLabel">
|
||||
<property name="text">
|
||||
<string>Aspect Ratio:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QDoubleSpinBox" name="farGuess">
|
||||
<property name="maximum">
|
||||
<double>1000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>10.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QDoubleSpinBox" name="camSpeed">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>0.000100000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>100.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.000100000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="matrixType">
|
||||
<property name="maxVisibleItems">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="maxCount">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="insertPolicy">
|
||||
<enum>QComboBox::NoInsert</enum>
|
||||
</property>
|
||||
<property name="frame">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QLabel" name="minBoundsLabel">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="matrixTypeLabel">
|
||||
<property name="text">
|
||||
<string>Matrix Type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QDoubleSpinBox" name="nearGuess">
|
||||
<property name="maximum">
|
||||
<double>100.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.010000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>39</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QLabel" name="maxBoundsLabel">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Bounding Box:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
||||
Reference in New Issue
Block a user