mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-23 06:56:40 +00:00
address PR feedback
- create AxisMapping struct and fix camera location issue - add more detail to axis mapping error message - fix other minor issues
This commit is contained in:
committed by
Baldur Karlsson
parent
35f4fad20e
commit
5ed073f395
@@ -2951,16 +2951,19 @@ void BufferViewer::populateBBox(PopulateBufferData *bufdata)
|
||||
QVariant BufferViewer::persistData()
|
||||
{
|
||||
QVariantMap state;
|
||||
state[lit("dockarea")] = ui->dockarea->saveState();
|
||||
state = ui->dockarea->saveState();
|
||||
state[lit("axisMappingIndex")] = ui->axisMappingCombo->currentIndex();
|
||||
QVariantList xAxisMapping = {QVariant(m_Config.xAxisMapping.x), QVariant(m_Config.xAxisMapping.y),
|
||||
QVariant(m_Config.xAxisMapping.z)};
|
||||
QVariantList xAxisMapping = {QVariant(m_Config.axisMapping.xAxis.x),
|
||||
QVariant(m_Config.axisMapping.xAxis.y),
|
||||
QVariant(m_Config.axisMapping.xAxis.z)};
|
||||
state[lit("xAxisMapping")] = xAxisMapping;
|
||||
QVariantList yAxisMapping = {QVariant(m_Config.yAxisMapping.x), QVariant(m_Config.yAxisMapping.y),
|
||||
QVariant(m_Config.yAxisMapping.z)};
|
||||
QVariantList yAxisMapping = {QVariant(m_Config.axisMapping.yAxis.x),
|
||||
QVariant(m_Config.axisMapping.yAxis.y),
|
||||
QVariant(m_Config.axisMapping.yAxis.z)};
|
||||
state[lit("yAxisMapping")] = yAxisMapping;
|
||||
QVariantList zAxisMapping = {QVariant(m_Config.zAxisMapping.x), QVariant(m_Config.zAxisMapping.y),
|
||||
QVariant(m_Config.zAxisMapping.z)};
|
||||
QVariantList zAxisMapping = {QVariant(m_Config.axisMapping.zAxis.x),
|
||||
QVariant(m_Config.axisMapping.zAxis.y),
|
||||
QVariant(m_Config.axisMapping.zAxis.z)};
|
||||
state[lit("zAxisMapping")] = zAxisMapping;
|
||||
|
||||
return state;
|
||||
@@ -2970,19 +2973,20 @@ void BufferViewer::setPersistData(const QVariant &persistData)
|
||||
{
|
||||
QVariantMap state = persistData.toMap();
|
||||
|
||||
ui->dockarea->restoreState(state[lit("dockarea")].toMap());
|
||||
ui->axisMappingCombo->setCurrentIndex(state[lit("axisMappingIndex")].toInt());
|
||||
ui->dockarea->restoreState(state);
|
||||
previousAxisMappingIndex = state[lit("axisMappingIndex")].toInt();
|
||||
ui->axisMappingCombo->setCurrentIndex(previousAxisMappingIndex);
|
||||
if(!state[lit("xAxisMapping")].toList().isEmpty())
|
||||
{
|
||||
m_Config.xAxisMapping.x = state[lit("xAxisMapping")].toList()[0].toInt();
|
||||
m_Config.xAxisMapping.y = state[lit("xAxisMapping")].toList()[1].toInt();
|
||||
m_Config.xAxisMapping.z = state[lit("xAxisMapping")].toList()[2].toInt();
|
||||
m_Config.yAxisMapping.x = state[lit("yAxisMapping")].toList()[0].toInt();
|
||||
m_Config.yAxisMapping.y = state[lit("yAxisMapping")].toList()[1].toInt();
|
||||
m_Config.yAxisMapping.z = state[lit("yAxisMapping")].toList()[2].toInt();
|
||||
m_Config.zAxisMapping.x = state[lit("zAxisMapping")].toList()[0].toInt();
|
||||
m_Config.zAxisMapping.y = state[lit("zAxisMapping")].toList()[1].toInt();
|
||||
m_Config.zAxisMapping.z = state[lit("zAxisMapping")].toList()[2].toInt();
|
||||
m_Config.axisMapping.xAxis.x = state[lit("xAxisMapping")].toList()[0].toInt();
|
||||
m_Config.axisMapping.xAxis.y = state[lit("xAxisMapping")].toList()[1].toInt();
|
||||
m_Config.axisMapping.xAxis.z = state[lit("xAxisMapping")].toList()[2].toInt();
|
||||
m_Config.axisMapping.yAxis.x = state[lit("yAxisMapping")].toList()[0].toInt();
|
||||
m_Config.axisMapping.yAxis.y = state[lit("yAxisMapping")].toList()[1].toInt();
|
||||
m_Config.axisMapping.yAxis.z = state[lit("yAxisMapping")].toList()[2].toInt();
|
||||
m_Config.axisMapping.zAxis.x = state[lit("zAxisMapping")].toList()[0].toInt();
|
||||
m_Config.axisMapping.zAxis.y = state[lit("zAxisMapping")].toList()[1].toInt();
|
||||
m_Config.axisMapping.zAxis.z = state[lit("zAxisMapping")].toList()[2].toInt();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3174,6 +3178,22 @@ void BufferViewer::UI_ResetArcball()
|
||||
mid.y = bbox.bounds[stage].Min[posEl].y + diag.y * 0.5f;
|
||||
mid.z = bbox.bounds[stage].Min[posEl].z + diag.z * 0.5f;
|
||||
|
||||
if(!isCurrentRasterOut())
|
||||
{
|
||||
// apply axis mapping to midpoint
|
||||
FloatVector transformedMid;
|
||||
transformedMid.x = m_Config.axisMapping.xAxis.x * mid.x +
|
||||
m_Config.axisMapping.yAxis.x * mid.y +
|
||||
m_Config.axisMapping.zAxis.x * mid.z;
|
||||
transformedMid.y = m_Config.axisMapping.xAxis.y * mid.x +
|
||||
m_Config.axisMapping.yAxis.y * mid.y +
|
||||
m_Config.axisMapping.zAxis.y * mid.z;
|
||||
transformedMid.z = m_Config.axisMapping.xAxis.z * mid.x +
|
||||
m_Config.axisMapping.yAxis.z * mid.y +
|
||||
m_Config.axisMapping.zAxis.z * mid.z;
|
||||
mid = transformedMid;
|
||||
}
|
||||
|
||||
m_Arcball->Reset(mid, len * 0.7f);
|
||||
|
||||
GUIInvoke::call(this, [this, len]() { ui->camSpeed->setValue(len / 200.0f); });
|
||||
@@ -4066,47 +4086,46 @@ void BufferViewer::on_axisMappingCombo_currentIndexChanged(int index)
|
||||
switch(index)
|
||||
{
|
||||
case 0: // Y-up, Left Handed
|
||||
m_Config.xAxisMapping = FloatVector(1.0f, 0.0f, 0.0f, 0.0f);
|
||||
m_Config.yAxisMapping = FloatVector(0.0f, 1.0f, 0.0f, 0.0f);
|
||||
m_Config.zAxisMapping = FloatVector(0.0f, 0.0f, 1.0f, 0.0f);
|
||||
m_Config.axisMapping.xAxis = FloatVector(1.0f, 0.0f, 0.0f, 0.0f);
|
||||
m_Config.axisMapping.yAxis = FloatVector(0.0f, 1.0f, 0.0f, 0.0f);
|
||||
m_Config.axisMapping.zAxis = FloatVector(0.0f, 0.0f, 1.0f, 0.0f);
|
||||
break;
|
||||
case 1: // Y-up, Right Handed
|
||||
m_Config.xAxisMapping = FloatVector(1.0f, 0.0f, 0.0f, 0.0f);
|
||||
m_Config.yAxisMapping = FloatVector(0.0f, 1.0f, 0.0f, 0.0f);
|
||||
m_Config.zAxisMapping = FloatVector(0.0f, 0.0f, -1.0f, 0.0f);
|
||||
m_Config.axisMapping.xAxis = FloatVector(1.0f, 0.0f, 0.0f, 0.0f);
|
||||
m_Config.axisMapping.yAxis = FloatVector(0.0f, 1.0f, 0.0f, 0.0f);
|
||||
m_Config.axisMapping.zAxis = FloatVector(0.0f, 0.0f, -1.0f, 0.0f);
|
||||
break;
|
||||
case 2: // Z-up, Left Handed
|
||||
m_Config.xAxisMapping = FloatVector(1.0f, 0.0f, 0.0f, 0.0f);
|
||||
m_Config.yAxisMapping = FloatVector(0.0f, 0.0f, -1.0f, 0.0f);
|
||||
m_Config.zAxisMapping = FloatVector(0.0f, 1.0f, 0.0f, 0.0f);
|
||||
m_Config.axisMapping.xAxis = FloatVector(1.0f, 0.0f, 0.0f, 0.0f);
|
||||
m_Config.axisMapping.yAxis = FloatVector(0.0f, 0.0f, -1.0f, 0.0f);
|
||||
m_Config.axisMapping.zAxis = FloatVector(0.0f, 1.0f, 0.0f, 0.0f);
|
||||
break;
|
||||
case 3: // Z-up, Right Handed
|
||||
m_Config.xAxisMapping = FloatVector(1.0f, 0.0f, 0.0f, 0.0f);
|
||||
m_Config.yAxisMapping = FloatVector(0.0f, 0.0f, 1.0f, 0.0f);
|
||||
m_Config.zAxisMapping = FloatVector(0.0f, 1.0f, 0.0f, 0.0f);
|
||||
m_Config.axisMapping.xAxis = FloatVector(1.0f, 0.0f, 0.0f, 0.0f);
|
||||
m_Config.axisMapping.yAxis = FloatVector(0.0f, 0.0f, 1.0f, 0.0f);
|
||||
m_Config.axisMapping.zAxis = FloatVector(0.0f, 1.0f, 0.0f, 0.0f);
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
ui->axisMappingButton->setEnabled(false);
|
||||
previousAxisMappingIndex = index;
|
||||
on_resetCamera_clicked();
|
||||
INVOKE_MEMFN(RT_UpdateAndDisplay);
|
||||
}
|
||||
else
|
||||
else if(previousAxisMappingIndex != 4)
|
||||
{
|
||||
ui->axisMappingButton->setEnabled(true);
|
||||
}
|
||||
}
|
||||
AxisMappingDialog dialog(m_Ctx, m_Config, this);
|
||||
RDDialog::show(&dialog);
|
||||
|
||||
void BufferViewer::on_axisMappingButton_clicked()
|
||||
{
|
||||
AxisMappingDialog dialog(m_Ctx, m_Config, this);
|
||||
RDDialog::show(&dialog);
|
||||
|
||||
if(dialog.result() == QDialog::Accepted)
|
||||
{
|
||||
m_Config.xAxisMapping = dialog.getXAxisMapping();
|
||||
m_Config.yAxisMapping = dialog.getYAxisMapping();
|
||||
m_Config.zAxisMapping = dialog.getZAxisMapping();
|
||||
INVOKE_MEMFN(RT_UpdateAndDisplay);
|
||||
if(dialog.result() == QDialog::Accepted)
|
||||
{
|
||||
m_Config.axisMapping = dialog.getAxisMapping();
|
||||
on_resetCamera_clicked();
|
||||
INVOKE_MEMFN(RT_UpdateAndDisplay);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->axisMappingCombo->setCurrentIndex(previousAxisMappingIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4825,6 +4844,19 @@ void BufferViewer::on_autofitCamera_clicked()
|
||||
mid.y = bbox.bounds[stage].Min[posEl].y + diag.y * 0.5f;
|
||||
mid.z = bbox.bounds[stage].Min[posEl].z + diag.z * 0.5f;
|
||||
|
||||
if(!isCurrentRasterOut())
|
||||
{
|
||||
// apply axis mapping to midpoint
|
||||
FloatVector transformedMid;
|
||||
transformedMid.x = m_Config.axisMapping.xAxis.x * mid.x +
|
||||
m_Config.axisMapping.yAxis.x * mid.y + m_Config.axisMapping.zAxis.x * mid.z;
|
||||
transformedMid.y = m_Config.axisMapping.xAxis.y * mid.x +
|
||||
m_Config.axisMapping.yAxis.y * mid.y + m_Config.axisMapping.zAxis.y * mid.z;
|
||||
transformedMid.z = m_Config.axisMapping.xAxis.z * mid.x +
|
||||
m_Config.axisMapping.yAxis.z * mid.y + m_Config.axisMapping.zAxis.z * mid.z;
|
||||
mid = transformedMid;
|
||||
}
|
||||
|
||||
mid.z -= len;
|
||||
|
||||
m_Flycam->Reset(mid);
|
||||
|
||||
@@ -119,7 +119,6 @@ private slots:
|
||||
void on_byteRangeStart_valueChanged(double value);
|
||||
void on_byteRangeLength_valueChanged(double value);
|
||||
void on_axisMappingCombo_currentIndexChanged(int index);
|
||||
void on_axisMappingButton_clicked();
|
||||
|
||||
// manual slots
|
||||
void render_mouseMove(QMouseEvent *e);
|
||||
@@ -215,6 +214,8 @@ private:
|
||||
int m_DataColWidth;
|
||||
int m_DataRowHeight;
|
||||
|
||||
int previousAxisMappingIndex = 0;
|
||||
|
||||
RichTextViewDelegate *m_delegate = NULL;
|
||||
|
||||
QMenu *m_HeaderMenu = NULL;
|
||||
|
||||
@@ -495,7 +495,7 @@ Enter 0.0 to use automatic/guessed value derived from data.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0" colspan="2">
|
||||
<item row="8" column="0" colspan="2">
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@@ -560,7 +560,7 @@ Enter 0.0 to use automatic/guessed value derived from data.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<item row="9" column="1">
|
||||
<widget class="QLabel" name="minBoundsLabel">
|
||||
<property name="text">
|
||||
<string/>
|
||||
@@ -584,7 +584,7 @@ Enter 0.0 to use automatic/guessed value derived from data.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<item row="11" column="1">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@@ -597,41 +597,31 @@ Enter 0.0 to use automatic/guessed value derived from data.</string>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<item row="10" column="1">
|
||||
<widget class="QLabel" name="maxBoundsLabel">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Bounding Box:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="axisMappingLabel">
|
||||
<property name="text">
|
||||
<string>Axis Mapping:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QPushButton" name="axisMappingButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Edit Custom Mapping</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="axisMappingLabel">
|
||||
<property name="text">
|
||||
<string>Axis Mapping:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QComboBox" name="axisMappingCombo"/>
|
||||
</item>
|
||||
</layout>
|
||||
<widget class="QComboBox" name="axisMappingCombo"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
#include "AxisMappingDialog.h"
|
||||
#include <QMessageBox>
|
||||
#include "Code/QRDUtils.h"
|
||||
#include "ui_AxisMappingDialog.h"
|
||||
|
||||
int AxisMappingDialog::getIndexFromVector(const FloatVector &v)
|
||||
@@ -87,67 +87,100 @@ FloatVector AxisMappingDialog::getVectorFromIndex(int index)
|
||||
return v;
|
||||
}
|
||||
|
||||
AxisMappingDialog::AxisMappingDialog(ICaptureContext &Ctx, const MeshDisplay &m_config,
|
||||
QWidget *parent)
|
||||
: QDialog(parent),
|
||||
m_Ctx(Ctx),
|
||||
xAxisMapping(m_config.xAxisMapping),
|
||||
yAxisMapping(m_config.yAxisMapping),
|
||||
zAxisMapping(m_config.zAxisMapping),
|
||||
ui(new Ui::AxisMappingDialog)
|
||||
AxisMappingDialog::AxisMappingDialog(ICaptureContext &Ctx, const MeshDisplay &config, QWidget *parent)
|
||||
: QDialog(parent), m_Ctx(Ctx), m_AxisMapping(config.axisMapping), ui(new Ui::AxisMappingDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
|
||||
const QStringList items{tr("Right"), tr("Left"), tr("Up"),
|
||||
tr("Down"), tr("Into Screen"), tr("Out of Screen")};
|
||||
const QStringList items = {tr("Right"), tr("Left"), tr("Up"),
|
||||
tr("Down"), tr("Into Screen"), tr("Out of Screen")};
|
||||
|
||||
ui->xAxisCombo->addItems(items);
|
||||
ui->yAxisCombo->addItems(items);
|
||||
ui->zAxisCombo->addItems(items);
|
||||
ui->xAxisCombo->setCurrentIndex(getIndexFromVector(xAxisMapping));
|
||||
ui->yAxisCombo->setCurrentIndex(getIndexFromVector(yAxisMapping));
|
||||
ui->zAxisCombo->setCurrentIndex(getIndexFromVector(zAxisMapping));
|
||||
ui->xAxisCombo->setCurrentIndex(getIndexFromVector(m_AxisMapping.xAxis));
|
||||
ui->yAxisCombo->setCurrentIndex(getIndexFromVector(m_AxisMapping.yAxis));
|
||||
ui->zAxisCombo->setCurrentIndex(getIndexFromVector(m_AxisMapping.zAxis));
|
||||
|
||||
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &AxisMappingDialog::setNewAxisMappings);
|
||||
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &AxisMappingDialog::setNewAxisMapping);
|
||||
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||
}
|
||||
|
||||
void AxisMappingDialog::setNewAxisMappings()
|
||||
void AxisMappingDialog::setNewAxisMapping()
|
||||
{
|
||||
int xIndex = ui->xAxisCombo->currentIndex();
|
||||
int yIndex = ui->yAxisCombo->currentIndex();
|
||||
int zIndex = ui->zAxisCombo->currentIndex();
|
||||
|
||||
if(xIndex / 2 != yIndex / 2 && yIndex / 2 != zIndex / 2 && xIndex / 2 != zIndex / 2)
|
||||
int xDirection = xIndex / 2;
|
||||
int yDirection = yIndex / 2;
|
||||
int zDirection = zIndex / 2;
|
||||
|
||||
if(xDirection != yDirection && yDirection != zDirection && xDirection != zDirection)
|
||||
{
|
||||
xAxisMapping = getVectorFromIndex(xIndex);
|
||||
yAxisMapping = getVectorFromIndex(yIndex);
|
||||
zAxisMapping = getVectorFromIndex(zIndex);
|
||||
m_AxisMapping.xAxis = getVectorFromIndex(xIndex);
|
||||
m_AxisMapping.yAxis = getVectorFromIndex(yIndex);
|
||||
m_AxisMapping.zAxis = getVectorFromIndex(zIndex);
|
||||
accept();
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox messageBox;
|
||||
messageBox.critical(0, tr("Error"), tr("Your axis mappings are not compatible."));
|
||||
messageBox.setFixedSize(700, 150);
|
||||
QString firstWrongAxis;
|
||||
QString secondWrongAxis;
|
||||
int duplicateDirection;
|
||||
bool allAxesDegenerate = false;
|
||||
|
||||
if(xDirection == yDirection)
|
||||
{
|
||||
if(yDirection == zDirection)
|
||||
{
|
||||
allAxesDegenerate = true;
|
||||
}
|
||||
firstWrongAxis = tr("X");
|
||||
secondWrongAxis = tr("Y");
|
||||
duplicateDirection = xDirection;
|
||||
}
|
||||
else if(yDirection == zDirection)
|
||||
{
|
||||
firstWrongAxis = tr("Y");
|
||||
secondWrongAxis = tr("Z");
|
||||
duplicateDirection = yDirection;
|
||||
}
|
||||
else
|
||||
{
|
||||
firstWrongAxis = tr("X");
|
||||
secondWrongAxis = tr("Z");
|
||||
duplicateDirection = zDirection;
|
||||
}
|
||||
|
||||
const QStringList directions = {tr("left/right"), tr("up/down"),
|
||||
tr("into screen/out of screen")};
|
||||
|
||||
QString messageText;
|
||||
if(allAxesDegenerate)
|
||||
{
|
||||
messageText = tr("The selected axis mappings are degenerate "
|
||||
"and do not cover all three directions:\n\n"
|
||||
"All axes are mapped to the %1 direction.")
|
||||
.arg(directions.at(duplicateDirection));
|
||||
}
|
||||
else
|
||||
{
|
||||
messageText = tr("The selected axis mappings are degenerate "
|
||||
"and do not cover all three directions:\n\n"
|
||||
"%1 and %2 are both mapped to the %3 direction.")
|
||||
.arg(firstWrongAxis)
|
||||
.arg(secondWrongAxis)
|
||||
.arg(directions.at(duplicateDirection));
|
||||
}
|
||||
RDDialog::critical(this, tr("Error mapping axes"), messageText);
|
||||
}
|
||||
// insert error message logic here
|
||||
}
|
||||
|
||||
FloatVector AxisMappingDialog::getXAxisMapping()
|
||||
const AxisMapping &AxisMappingDialog::getAxisMapping()
|
||||
{
|
||||
return xAxisMapping;
|
||||
}
|
||||
|
||||
FloatVector AxisMappingDialog::getYAxisMapping()
|
||||
{
|
||||
return yAxisMapping;
|
||||
}
|
||||
|
||||
FloatVector AxisMappingDialog::getZAxisMapping()
|
||||
{
|
||||
return zAxisMapping;
|
||||
return m_AxisMapping;
|
||||
}
|
||||
|
||||
AxisMappingDialog::~AxisMappingDialog()
|
||||
|
||||
@@ -38,19 +38,15 @@ class AxisMappingDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit AxisMappingDialog(ICaptureContext &Ctx, const MeshDisplay &m_config, QWidget *parent = 0);
|
||||
FloatVector getXAxisMapping();
|
||||
FloatVector getYAxisMapping();
|
||||
FloatVector getZAxisMapping();
|
||||
explicit AxisMappingDialog(ICaptureContext &Ctx, const MeshDisplay &config, QWidget *parent = 0);
|
||||
const AxisMapping &getAxisMapping();
|
||||
~AxisMappingDialog();
|
||||
|
||||
private:
|
||||
Ui::AxisMappingDialog *ui;
|
||||
ICaptureContext &m_Ctx;
|
||||
FloatVector xAxisMapping;
|
||||
FloatVector yAxisMapping;
|
||||
FloatVector zAxisMapping;
|
||||
void setNewAxisMappings();
|
||||
AxisMapping m_AxisMapping;
|
||||
void setNewAxisMapping();
|
||||
|
||||
static int getIndexFromVector(const FloatVector &v);
|
||||
static FloatVector getVectorFromIndex(int index);
|
||||
|
||||
@@ -129,23 +129,11 @@ struct MeshDisplay
|
||||
)");
|
||||
ICamera *cam = NULL;
|
||||
|
||||
DOCUMENT(R"(The mapping of the x axis of the mesh's coordinate system.
|
||||
DOCUMENT(R"(The axis mapping to apply to the mesh.
|
||||
|
||||
:type: FloatVector
|
||||
:type: AxisMapping
|
||||
)");
|
||||
FloatVector xAxisMapping;
|
||||
|
||||
DOCUMENT(R"(The mapping of the y axis of the mesh's coordinate system.
|
||||
|
||||
:type: FloatVector
|
||||
)");
|
||||
FloatVector yAxisMapping;
|
||||
|
||||
DOCUMENT(R"(The mapping of the z axis of the mesh's coordinate system.
|
||||
|
||||
:type: FloatVector
|
||||
)");
|
||||
FloatVector zAxisMapping;
|
||||
AxisMapping axisMapping;
|
||||
|
||||
DOCUMENT(
|
||||
"``True`` if the projection matrix to use when unprojecting vertex positions is "
|
||||
|
||||
@@ -74,6 +74,40 @@ struct FloatVector
|
||||
|
||||
DECLARE_REFLECTION_STRUCT(FloatVector);
|
||||
|
||||
DOCUMENT("A transform to map the x, y, and z axes to new directions.");
|
||||
struct AxisMapping
|
||||
{
|
||||
AxisMapping()
|
||||
: xAxis(1.0f, 0.0f, 0.0f, 0.0f), yAxis(0.0f, 1.0f, 0.0f, 0.0f), zAxis(0.0f, 0.0f, 1.0f, 0.0f)
|
||||
{
|
||||
}
|
||||
AxisMapping(const FloatVector &XAxis, const FloatVector &YAxis, const FloatVector &ZAxis)
|
||||
: xAxis(XAxis), yAxis(YAxis), zAxis(ZAxis)
|
||||
{
|
||||
}
|
||||
AxisMapping(const AxisMapping &) = default;
|
||||
AxisMapping &operator=(const AxisMapping &) = default;
|
||||
DOCUMENT(R"(The mapping of the x axis.
|
||||
|
||||
:type: FloatVector
|
||||
)");
|
||||
FloatVector xAxis;
|
||||
|
||||
DOCUMENT(R"(The mapping of the y axis.
|
||||
|
||||
:type: FloatVector
|
||||
)");
|
||||
FloatVector yAxis;
|
||||
|
||||
DOCUMENT(R"(The mapping of the z axis.
|
||||
|
||||
:type: FloatVector
|
||||
)");
|
||||
FloatVector zAxis;
|
||||
};
|
||||
|
||||
DECLARE_REFLECTION_STRUCT(AxisMapping);
|
||||
|
||||
DOCUMENT("Properties of a path on a remote filesystem.");
|
||||
struct PathEntry
|
||||
{
|
||||
|
||||
@@ -2238,21 +2238,6 @@ bool GLReplay::GetHistogram(ResourceId texid, const Subresource &sub, CompType t
|
||||
return true;
|
||||
}
|
||||
|
||||
static Matrix4f getAxisMapMat(const MeshDisplay &cfg)
|
||||
{
|
||||
Matrix4f axisMapMat = Matrix4f::Identity();
|
||||
axisMapMat[0] = cfg.xAxisMapping.x;
|
||||
axisMapMat[4] = cfg.xAxisMapping.y;
|
||||
axisMapMat[8] = cfg.xAxisMapping.z;
|
||||
axisMapMat[1] = cfg.yAxisMapping.x;
|
||||
axisMapMat[5] = cfg.yAxisMapping.y;
|
||||
axisMapMat[9] = cfg.yAxisMapping.z;
|
||||
axisMapMat[2] = cfg.zAxisMapping.x;
|
||||
axisMapMat[6] = cfg.zAxisMapping.y;
|
||||
axisMapMat[10] = cfg.zAxisMapping.z;
|
||||
return axisMapMat;
|
||||
}
|
||||
|
||||
uint32_t GLReplay::PickVertex(uint32_t eventId, int32_t width, int32_t height,
|
||||
const MeshDisplay &cfg, uint32_t x, uint32_t y)
|
||||
{
|
||||
@@ -2271,7 +2256,7 @@ uint32_t GLReplay::PickVertex(uint32_t eventId, int32_t width, int32_t height,
|
||||
Matrix4f pickMVP = projMat.Mul(camMat);
|
||||
if(!cfg.position.unproject)
|
||||
{
|
||||
pickMVP = pickMVP.Mul(getAxisMapMat(cfg));
|
||||
pickMVP = pickMVP.Mul(Matrix4f(cfg.axisMapping));
|
||||
}
|
||||
|
||||
bool reverseProjection = false;
|
||||
|
||||
@@ -33,21 +33,6 @@
|
||||
#define OPENGL 1
|
||||
#include "data/glsl/glsl_ubos_cpp.h"
|
||||
|
||||
static Matrix4f getAxisMapMat(const MeshDisplay &cfg)
|
||||
{
|
||||
Matrix4f axisMapMat = Matrix4f::Identity();
|
||||
axisMapMat[0] = cfg.xAxisMapping.x;
|
||||
axisMapMat[4] = cfg.xAxisMapping.y;
|
||||
axisMapMat[8] = cfg.xAxisMapping.z;
|
||||
axisMapMat[1] = cfg.yAxisMapping.x;
|
||||
axisMapMat[5] = cfg.yAxisMapping.y;
|
||||
axisMapMat[9] = cfg.yAxisMapping.z;
|
||||
axisMapMat[2] = cfg.zAxisMapping.x;
|
||||
axisMapMat[6] = cfg.zAxisMapping.y;
|
||||
axisMapMat[10] = cfg.zAxisMapping.z;
|
||||
return axisMapMat;
|
||||
}
|
||||
|
||||
void GLReplay::RenderMesh(uint32_t eventId, const rdcarray<MeshFormat> &secondaryDraws,
|
||||
const MeshDisplay &cfg)
|
||||
{
|
||||
@@ -66,7 +51,7 @@ void GLReplay::RenderMesh(uint32_t eventId, const rdcarray<MeshFormat> &secondar
|
||||
|
||||
Matrix4f camMat = cfg.cam ? ((Camera *)cfg.cam)->GetMatrix() : Matrix4f::Identity();
|
||||
|
||||
Matrix4f axisMapMat = getAxisMapMat(cfg);
|
||||
Matrix4f axisMapMat = Matrix4f(cfg.axisMapping);
|
||||
|
||||
Matrix4f ModelViewProj = projMat.Mul(camMat.Mul(axisMapMat));
|
||||
Matrix4f guessProjInv;
|
||||
|
||||
@@ -28,9 +28,30 @@
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "api/replay/data_types.h"
|
||||
#include "quat.h"
|
||||
#include "vec.h"
|
||||
|
||||
Matrix4f::Matrix4f(const AxisMapping &axisMapping)
|
||||
{
|
||||
f[0] = axisMapping.xAxis.x;
|
||||
f[1] = axisMapping.xAxis.y;
|
||||
f[2] = axisMapping.xAxis.z;
|
||||
f[3] = axisMapping.xAxis.w;
|
||||
f[4] = axisMapping.yAxis.x;
|
||||
f[5] = axisMapping.yAxis.y;
|
||||
f[6] = axisMapping.yAxis.z;
|
||||
f[7] = axisMapping.yAxis.w;
|
||||
f[8] = axisMapping.zAxis.x;
|
||||
f[9] = axisMapping.zAxis.y;
|
||||
f[10] = axisMapping.zAxis.z;
|
||||
f[11] = axisMapping.zAxis.w;
|
||||
f[12] = 0.0f;
|
||||
f[13] = 0.0f;
|
||||
f[14] = 0.0f;
|
||||
f[15] = 1.0f;
|
||||
}
|
||||
|
||||
Matrix4f Matrix4f::Mul(const Matrix4f &o) const
|
||||
{
|
||||
Matrix4f m;
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
class Vec3f;
|
||||
class Quatf;
|
||||
struct AxisMapping;
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@@ -34,6 +35,7 @@ class Matrix4f
|
||||
{
|
||||
public:
|
||||
Matrix4f() {}
|
||||
Matrix4f(const AxisMapping &axisMapping);
|
||||
//////////////////////////////////////////////////////
|
||||
// Matrix generation functions
|
||||
|
||||
|
||||
Reference in New Issue
Block a user