From e6295fa309e870c6508dc33f21efe9f69b0ee43f Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 25 Jan 2017 20:04:06 +0000 Subject: [PATCH] Stub out BufferViewer UI controls, and make camera control properly --- qrenderdoc/Widgets/CustomPaintWidget.cpp | 5 + qrenderdoc/Widgets/CustomPaintWidget.h | 2 + qrenderdoc/Windows/BufferViewer.cpp | 479 ++++++++++--- qrenderdoc/Windows/BufferViewer.h | 14 +- qrenderdoc/Windows/BufferViewer.ui | 870 ++++++++++++++++++++--- 5 files changed, 1144 insertions(+), 226 deletions(-) diff --git a/qrenderdoc/Widgets/CustomPaintWidget.cpp b/qrenderdoc/Widgets/CustomPaintWidget.cpp index d57521fed..461f91c67 100644 --- a/qrenderdoc/Widgets/CustomPaintWidget.cpp +++ b/qrenderdoc/Widgets/CustomPaintWidget.cpp @@ -80,6 +80,11 @@ void CustomPaintWidget::keyPressEvent(QKeyEvent *e) emit keyPress(e); } +void CustomPaintWidget::keyReleaseEvent(QKeyEvent *e) +{ + emit keyRelease(e); +} + void CustomPaintWidget::paintEvent(QPaintEvent *e) { if(m_Ctx) diff --git a/qrenderdoc/Widgets/CustomPaintWidget.h b/qrenderdoc/Widgets/CustomPaintWidget.h index 4b0f8d2ed..0721bff0c 100644 --- a/qrenderdoc/Widgets/CustomPaintWidget.h +++ b/qrenderdoc/Widgets/CustomPaintWidget.h @@ -58,6 +58,7 @@ signals: void resize(QResizeEvent *e); void mouseWheel(QWheelEvent *e); void keyPress(QKeyEvent *e); + void keyRelease(QKeyEvent *e); private: void mousePressEvent(QMouseEvent *e) override; @@ -66,6 +67,7 @@ private: void wheelEvent(QWheelEvent *e) override; void resizeEvent(QResizeEvent *e) override; void keyPressEvent(QKeyEvent *e) override; + void keyReleaseEvent(QKeyEvent *e) override; public slots: diff --git a/qrenderdoc/Windows/BufferViewer.cpp b/qrenderdoc/Windows/BufferViewer.cpp index 5120cb7a5..3bca6cc6f 100644 --- a/qrenderdoc/Windows/BufferViewer.cpp +++ b/qrenderdoc/Windows/BufferViewer.cpp @@ -25,8 +25,278 @@ #include "BufferViewer.h" #include #include +#include #include "ui_BufferViewer.h" +class CameraWrapper +{ +public: + virtual bool Update(QRect winSize) = 0; + virtual Camera *camera() = 0; + + virtual void MouseWheel(QWheelEvent *e) = 0; + + virtual void MouseClick(QMouseEvent *e) { m_DragStartPos = e->pos(); } + virtual void MouseMove(QMouseEvent *e) + { + if(e->buttons() & Qt::LeftButton) + { + if(m_DragStartPos.x() < 0) + { + m_DragStartPos = e->pos(); + } + + m_DragStartPos = e->pos(); + } + else + { + m_DragStartPos = QPoint(-1, -1); + } + } + + virtual void KeyUp(QKeyEvent *e) + { + if(e->key() == Qt::Key_A || e->key() == Qt::Key_D) + setMove(Direction::Horiz, 0); + if(e->key() == Qt::Key_Q || e->key() == Qt::Key_E) + setMove(Direction::Vert, 0); + if(e->key() == Qt::Key_W || e->key() == Qt::Key_S) + setMove(Direction::Fwd, 0); + + if(e->modifiers() && Qt::ShiftModifier) + m_CurrentSpeed = 3.0f; + else + m_CurrentSpeed = 1.0f; + } + + virtual void KeyDown(QKeyEvent *e) + { + if(e->key() == Qt::Key_W) + setMove(Direction::Fwd, 1); + if(e->key() == Qt::Key_S) + setMove(Direction::Fwd, -1); + if(e->key() == Qt::Key_Q) + setMove(Direction::Vert, 1); + if(e->key() == Qt::Key_E) + setMove(Direction::Vert, -1); + if(e->key() == Qt::Key_D) + setMove(Direction::Horiz, 1); + if(e->key() == Qt::Key_A) + setMove(Direction::Horiz, -1); + + if(e->modifiers() && Qt::ShiftModifier) + m_CurrentSpeed = 3.0f; + else + m_CurrentSpeed = 1.0f; + } + + float SpeedMultiplier = 0.05f; + +protected: + enum class Direction + { + Fwd, + Horiz, + Vert, + Num + }; + + int move(Direction dir) { return m_CurrentMove[(int)dir]; } + float currentSpeed() { return m_CurrentSpeed * SpeedMultiplier; } + QPoint dragStartPos() { return m_DragStartPos; } +private: + float m_CurrentSpeed = 1.0f; + int m_CurrentMove[(int)Direction::Num] = {0, 0, 0}; + + void setMove(Direction dir, int val) { m_CurrentMove[(int)dir] = val; } + QPoint m_DragStartPos = QPoint(-1, -1); +}; + +class ArcballWrapper : public CameraWrapper +{ +public: + ArcballWrapper() { m_Cam = Camera_InitArcball(); } + ~ArcballWrapper() { Camera_Shutdown(m_Cam); } + Camera *camera() override { return m_Cam; } + void Reset(FloatVector pos, float dist) + { + Camera_ResetArcball(m_Cam); + + setLookAtPos(pos); + SetDistance(dist); + } + + void SetDistance(float dist) + { + m_Distance = qAbs(dist); + Camera_SetArcballDistance(m_Cam, m_Distance); + } + + bool Update(QRect size) override + { + m_WinSize = size; + return false; + } + + void MouseWheel(QWheelEvent *e) override + { + float mod = (1.0f - e->delta() / 2500.0f); + + SetDistance(qMax(1e-6f, m_Distance * mod)); + } + + void MouseMove(QMouseEvent *e) override + { + if(dragStartPos().x() > 0) + { + if(e->buttons() == Qt::MiddleButton || + (e->buttons() == Qt::LeftButton && e->modifiers() & Qt::AltModifier)) + { + float xdelta = (float)(e->pos().x() - dragStartPos().x()) / 300.0f; + float ydelta = (float)(e->pos().y() - dragStartPos().y()) / 300.0f; + + xdelta *= qMax(1.0f, m_Distance); + ydelta *= qMax(1.0f, m_Distance); + + FloatVector pos, fwd, right, up; + Camera_GetBasis(m_Cam, &pos, &fwd, &right, &up); + + m_LookAt.x -= right.x * xdelta; + m_LookAt.y -= right.y * xdelta; + m_LookAt.z -= right.z * xdelta; + + m_LookAt.x += up.x * ydelta; + m_LookAt.y += up.y * ydelta; + m_LookAt.z += up.z * ydelta; + + Camera_SetPosition(m_Cam, m_LookAt.x, m_LookAt.y, m_LookAt.z); + } + else if(e->buttons() == Qt::LeftButton) + { + RotateArcball(dragStartPos(), e->pos()); + } + } + + CameraWrapper::MouseMove(e); + } + + FloatVector lookAtPos() { return m_LookAt; } + void setLookAtPos(const FloatVector &v) + { + m_LookAt = v; + Camera_SetPosition(m_Cam, v.x, v.y, v.z); + } + +private: + Camera *m_Cam; + + QRect m_WinSize; + + float m_Distance = 10.0f; + FloatVector m_LookAt; + + void RotateArcball(QPoint from, QPoint to) + { + float ax = ((float)from.x() / (float)m_WinSize.width()) * 2.0f - 1.0f; + float ay = ((float)from.y() / (float)m_WinSize.height()) * 2.0f - 1.0f; + float bx = ((float)to.x() / (float)m_WinSize.width()) * 2.0f - 1.0f; + float by = ((float)to.y() / (float)m_WinSize.height()) * 2.0f - 1.0f; + + // this isn't a 'true arcball' but it handles extreme aspect ratios + // better. We basically 'centre' around the from point always being + // 0,0 (straight out of the screen) as if you're always dragging + // the arcball from the middle, and just use the relative movement + int minDimension = qMin(m_WinSize.width(), m_WinSize.height()); + + ax = ay = 0; + bx = ((float)(to.x() - from.x()) / (float)minDimension) * 2.0f; + by = ((float)(to.y() - from.y()) / (float)minDimension) * 2.0f; + + ay = -ay; + by = -by; + + Camera_RotateArcball(m_Cam, ax, ay, bx, by); + } +}; + +class FlycamWrapper : public CameraWrapper +{ +public: + FlycamWrapper() { m_Cam = Camera_InitFPSLook(); } + ~FlycamWrapper() { Camera_Shutdown(m_Cam); } + Camera *camera() override { return m_Cam; } + void Reset(FloatVector pos) + { + m_Position = pos; + m_Rotation = FloatVector(); + + Camera_SetPosition(m_Cam, m_Position.x, m_Position.y, m_Position.z); + Camera_SetFPSRotation(m_Cam, m_Rotation.x, m_Rotation.y, m_Rotation.z); + } + + bool Update(QRect size) override + { + FloatVector pos, fwd, right, up; + Camera_GetBasis(m_Cam, &pos, &fwd, &right, &up); + + float speed = currentSpeed(); + + int horizMove = move(CameraWrapper::Direction::Horiz); + if(horizMove) + { + m_Position.x += right.x * speed * (float)horizMove; + m_Position.y += right.y * speed * (float)horizMove; + m_Position.z += right.z * speed * (float)horizMove; + } + + int vertMove = move(CameraWrapper::Direction::Vert); + if(vertMove) + { + // this makes less intuitive sense, instead go 'absolute' up + // m_Position.x += up.x * speed * (float)vertMove; + // m_Position.y += up.y * speed * (float)vertMove; + // m_Position.z += up.z * speed * (float)vertMove; + + m_Position.y += speed * (float)vertMove; + } + + int fwdMove = move(CameraWrapper::Direction::Fwd); + if(fwdMove) + { + m_Position.x += fwd.x * speed * (float)fwdMove; + m_Position.y += fwd.y * speed * (float)fwdMove; + m_Position.z += fwd.z * speed * (float)fwdMove; + } + + if(horizMove || vertMove || fwdMove) + { + Camera_SetPosition(m_Cam, m_Position.x, m_Position.y, m_Position.z); + return true; + } + + return false; + } + + void MouseWheel(QWheelEvent *e) override {} + void MouseMove(QMouseEvent *e) override + { + if(dragStartPos().x() > 0 && e->buttons() == Qt::LeftButton) + { + m_Rotation.y -= (float)(e->pos().x() - dragStartPos().x()) / 300.0f; + m_Rotation.x -= (float)(e->pos().y() - dragStartPos().y()) / 300.0f; + + Camera_SetFPSRotation(m_Cam, m_Rotation.x, m_Rotation.y, m_Rotation.z); + } + + CameraWrapper::MouseMove(e); + } + +private: + Camera *m_Cam; + + FloatVector m_Position, m_Rotation; +}; + struct BufferData { BufferData() @@ -224,13 +494,68 @@ BufferViewer::BufferViewer(CaptureContext *ctx, QWidget *parent) ui->vsinData->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont)); ui->vsoutData->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont)); + ui->gsoutData->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont)); + + ui->formatSpecifier->setVisible(false); + ui->cameraControlsGroup->setVisible(false); + + ui->outputTabs->setWindowTitle(tr("Preview")); + ui->dockarea->addToolWindow(ui->outputTabs, ToolWindowManager::EmptySpace); + ui->dockarea->setToolWindowProperties(ui->outputTabs, ToolWindowManager::HideCloseButton); + + ui->vsinData->setWindowTitle(tr("VS Input")); + ui->dockarea->addToolWindow( + ui->vsinData, ToolWindowManager::AreaReference(ToolWindowManager::TopOf, + ui->dockarea->areaOf(ui->outputTabs), 0.5f)); + ui->dockarea->setToolWindowProperties(ui->vsinData, ToolWindowManager::HideCloseButton); + + ui->vsoutData->setWindowTitle(tr("VS Output")); + ui->dockarea->addToolWindow( + ui->vsoutData, ToolWindowManager::AreaReference(ToolWindowManager::RightOf, + ui->dockarea->areaOf(ui->vsinData), 0.5f)); + ui->dockarea->setToolWindowProperties(ui->vsoutData, ToolWindowManager::HideCloseButton); + + ui->gsoutData->setWindowTitle(tr("GS/DS Output")); + ui->dockarea->addToolWindow( + ui->gsoutData, ToolWindowManager::AreaReference(ToolWindowManager::AddTo, + ui->dockarea->areaOf(ui->vsoutData), 0.5f)); + ui->dockarea->setToolWindowProperties(ui->gsoutData, ToolWindowManager::HideCloseButton); + + ToolWindowManager::raiseToolWindow(ui->vsoutData); + + ui->dockarea->setAllowFloatingWindow(false); + ui->dockarea->setRubberBandLineWidth(50); + + QVBoxLayout *vertical = new QVBoxLayout(this); + + vertical->setSpacing(3); + vertical->setContentsMargins(0, 0, 0, 0); + + vertical->addWidget(ui->meshToolbar); + vertical->addWidget(ui->dockarea); + + ui->controlType->addItems({tr("Arcball"), tr("WASD")}); + ui->controlType->adjustSize(); + + ui->drawRange->addItems({tr("Only this draw"), tr("Show previous instances"), + tr("Show all instances"), tr("Show whole pass")}); + ui->drawRange->adjustSize(); + + ui->solidShading->addItems({tr("None"), tr("Solid Colour"), tr("Flat Shaded"), tr("Secondary")}); + ui->solidShading->adjustSize(); m_ModelVSIn = new BufferItemModel(ui->vsinData, this); m_ModelVSOut = new BufferItemModel(ui->vsoutData, this); - // m_ModelGSOut = new BufferItemModel(ui->gsoutData, this); + m_ModelGSOut = new BufferItemModel(ui->gsoutData, this); + + m_Flycam = new FlycamWrapper(); + m_Arcball = new ArcballWrapper(); + m_CurrentCamera = m_Arcball; + + m_Arcball->Reset(FloatVector(), 10.0f); + m_Flycam->Reset(FloatVector()); m_ConfigVSIn.type = eMeshDataStage_VSIn; - m_ConfigVSIn.cam = Camera_InitArcball(); m_ConfigVSIn.ortho = false; m_ConfigVSIn.showPrevInstances = false; m_ConfigVSIn.showAllInstances = false; @@ -242,16 +567,10 @@ BufferViewer::BufferViewer(CaptureContext *ctx, QWidget *parent) memset(&m_ConfigVSIn.position, 0, sizeof(m_ConfigVSIn.position)); memset(&m_ConfigVSIn.second, 0, sizeof(m_ConfigVSIn.second)); - m_CamDist = 10.0f; - - Camera_SetArcballDistance(m_ConfigVSIn.cam, m_CamDist); - m_ConfigVSIn.position.showAlpha = false; m_ConfigVSOut = m_ConfigVSIn; - m_ConfigVSOut.cam = Camera_InitFPSLook(); - m_curConfig = &m_ConfigVSIn; ui->outputTabs->setCurrentIndex(0); @@ -260,6 +579,12 @@ BufferViewer::BufferViewer(CaptureContext *ctx, QWidget *parent) QObject::connect(ui->vsoutData->selectionModel(), &QItemSelectionModel::selectionChanged, this, &BufferViewer::data_selected); + QTimer *renderTimer = new QTimer(this); + QObject::connect(renderTimer, &QTimer::timeout, this, &BufferViewer::render_timer); + renderTimer->setSingleShot(false); + renderTimer->setInterval(1000); + renderTimer->start(); + Reset(); } @@ -270,8 +595,8 @@ BufferViewer::~BufferViewer() for(auto vb : m_ModelVSIn->buffers) delete[] vb.data; - Camera_Shutdown(m_ConfigVSIn.cam); - Camera_Shutdown(m_ConfigVSOut.cam); + delete m_Arcball; + delete m_Flycam; m_Ctx->windowClosed(this); m_Ctx->RemoveLogViewer(this); @@ -308,7 +633,7 @@ void BufferViewer::OnEventChanged(uint32_t eventID) { m_ModelVSIn->beginReset(); m_ModelVSOut->beginReset(); - // m_ModelGSOut->beginReset(); + m_ModelGSOut->beginReset(); // this doesn't account for sign characters m_ModelVSIn->componentWidth = 0; @@ -368,11 +693,6 @@ void BufferViewer::OnEventChanged(uint32_t eventID) uint64_t ioffset = 0; m_Ctx->CurPipelineState.GetIBuffer(ib, ioffset); - m_CamDist = 10.0f; - - Camera_ResetArcball(m_ConfigVSIn.cam); - Camera_SetArcballDistance(m_ConfigVSIn.cam, m_CamDist); - m_ConfigVSIn.fov = 90.0f; m_ConfigVSIn.aspect = m_Ctx->CurPipelineState.GetViewport(0).width / m_Ctx->CurPipelineState.GetViewport(0).height; @@ -482,11 +802,6 @@ void BufferViewer::OnEventChanged(uint32_t eventID) m_ConfigVSOut.aspect = m_ConfigVSIn.aspect; m_ConfigVSOut.highlightVert = m_ConfigVSIn.highlightVert; - Camera_SetPosition(m_ConfigVSOut.cam, 0.0f, 0.0f, 0.0f); - Camera_SetFPSRotation(m_ConfigVSOut.cam, 0.0f, 0.0f, 0.0f); - m_pos = FloatVector(); - m_rot = FloatVector(); - m_Ctx->Renderer()->AsyncInvoke([this, draw, vbs, ib, ioffset](IReplayRenderer *r) { rdctype::array idata; @@ -650,16 +965,16 @@ void BufferViewer::OnEventChanged(uint32_t eventID) GUIInvoke::call([this] { m_ModelVSIn->endReset(); m_ModelVSOut->endReset(); - ui->vsinData->resizeColumnsToContents(); - ui->vsoutData->resizeColumnsToContents(); + // ui->vsinData->resizeColumnsToContents(); + // ui->vsoutData->resizeColumnsToContents(); }); }); } void BufferViewer::on_outputTabs_currentChanged(int index) { - ui->render->parentWidget()->layout()->removeWidget(ui->render); - ui->outputTabs->widget(index)->layout()->addWidget(ui->render); + ui->renderContainer->parentWidget()->layout()->removeWidget(ui->renderContainer); + ui->outputTabs->widget(index)->layout()->addWidget(ui->renderContainer); if(index == 0) m_curConfig = &m_ConfigVSIn; @@ -674,55 +989,11 @@ void BufferViewer::render_mouseMove(QMouseEvent *e) if(!m_Ctx->LogLoaded()) return; - QPoint curpos = e->pos(); - - if(e->buttons() & Qt::LeftButton) - { - if(m_PrevPos != QPoint()) - { - if(m_curConfig == &m_ConfigVSIn) - { - float ax = ((float)m_PrevPos.x() / (float)ui->render->rect().width()) * 2.0f - 1.0f; - float ay = ((float)m_PrevPos.y() / (float)ui->render->rect().height()) * 2.0f - 1.0f; - float bx = ((float)curpos.x() / (float)ui->render->rect().width()) * 2.0f - 1.0f; - float by = ((float)curpos.y() / (float)ui->render->rect().height()) * 2.0f - 1.0f; - - // this isn't a 'true arcball' but it handles extreme aspect ratios - // better. We basically 'centre' around the from point always being - // 0,0 (straight out of the screen) as if you're always dragging - // the arcball from the middle, and just use the relative movement - int minDimension = qMin(ui->render->rect().width(), ui->render->rect().height()); - - ax = ay = 0; - bx = ((float)(curpos.x() - m_PrevPos.x()) / (float)minDimension) * 2.0f; - by = ((float)(curpos.y() - m_PrevPos.y()) / (float)minDimension) * 2.0f; - - ay = -ay; - by = -by; - - Camera_RotateArcball(m_curConfig->cam, ax, ay, bx, by); - } - else - { - m_rot.y -= (float)(curpos.x() - m_PrevPos.x()) / 300.0f; - m_rot.x -= (float)(curpos.y() - m_PrevPos.y()) / 300.0f; - - Camera_SetFPSRotation(m_curConfig->cam, m_rot.x, m_rot.y, m_rot.z); - } - } - - m_PrevPos = curpos; - } - else - { - m_PrevPos = QPoint(); - } + if(m_CurrentCamera) + m_CurrentCamera->MouseMove(e); if(e->buttons() & Qt::RightButton) - { render_clicked(e); - return; - } INVOKE_MEMFN(RT_UpdateAndDisplay); } @@ -732,8 +1003,6 @@ void BufferViewer::render_clicked(QMouseEvent *e) if(!m_Ctx->LogLoaded()) return; - ui->render->setFocus(); - QPoint curpos = e->pos(); if((e->buttons() & Qt::RightButton) && m_Output) @@ -765,62 +1034,43 @@ void BufferViewer::render_clicked(QMouseEvent *e) }); } + if(m_CurrentCamera) + m_CurrentCamera->MouseClick(e); + + ui->render->setFocus(); + INVOKE_MEMFN(RT_UpdateAndDisplay); } void BufferViewer::render_mouseWheel(QWheelEvent *e) { - float mod = (1.0f - e->delta() / 2500.0f); - - m_CamDist = qMax(1e-6f, m_CamDist * mod); - - Camera_SetArcballDistance(m_ConfigVSIn.cam, m_CamDist); + if(m_CurrentCamera) + m_CurrentCamera->MouseWheel(e); INVOKE_MEMFN(RT_UpdateAndDisplay); } void BufferViewer::render_keyPress(QKeyEvent *e) { - if(m_curConfig != &m_ConfigVSIn) - { - FloatVector pos, fwd, right, up; - Camera_GetBasis(m_curConfig->cam, &pos, &fwd, &right, &up); + m_CurrentCamera->KeyDown(e); +} - if(e->key() == Qt::Key_W) - { - m_pos.x += fwd.x * 0.1f; - m_pos.y += fwd.y * 0.1f; - m_pos.z += fwd.z * 0.1f; - } - if(e->key() == Qt::Key_S) - { - m_pos.x -= fwd.x * 0.1f; - m_pos.y -= fwd.y * 0.1f; - m_pos.z -= fwd.z * 0.1f; - } - if(e->key() == Qt::Key_A) - { - m_pos.x -= right.x * 0.1f; - m_pos.y -= right.y * 0.1f; - m_pos.z -= right.z * 0.1f; - } - if(e->key() == Qt::Key_D) - { - m_pos.x += right.x * 0.1f; - m_pos.y += right.y * 0.1f; - m_pos.z += right.z * 0.1f; - } +void BufferViewer::render_keyRelease(QKeyEvent *e) +{ + m_CurrentCamera->KeyUp(e); +} - Camera_SetPosition(m_curConfig->cam, m_pos.x, m_pos.y, m_pos.z); - } - - INVOKE_MEMFN(RT_UpdateAndDisplay); +void BufferViewer::render_timer() +{ + if(m_CurrentCamera && m_CurrentCamera->Update(ui->render->rect())) + INVOKE_MEMFN(RT_UpdateAndDisplay); } void BufferViewer::RT_UpdateAndDisplay(IReplayRenderer *) { if(m_Output) { + m_curConfig->cam = m_CurrentCamera->camera(); m_Output->SetMeshDisplay(*m_curConfig); m_Output->Display(); } @@ -854,12 +1104,14 @@ void BufferViewer::Reset() render->setSizePolicy(ui->render->sizePolicy()); delete ui->render; ui->render = render; - ui->outputTabs->currentWidget()->layout()->addWidget(ui->render); + ui->renderContainerGridLayout->addWidget(ui->render, 1, 1, 1, 1); } QObject::connect(ui->render, &CustomPaintWidget::mouseMove, this, &BufferViewer::render_mouseMove); QObject::connect(ui->render, &CustomPaintWidget::clicked, this, &BufferViewer::render_clicked); QObject::connect(ui->render, &CustomPaintWidget::keyPress, this, &BufferViewer::render_keyPress); + QObject::connect(ui->render, &CustomPaintWidget::keyRelease, this, + &BufferViewer::render_keyRelease); QObject::connect(ui->render, &CustomPaintWidget::mouseWheel, this, &BufferViewer::render_mouseWheel); @@ -882,3 +1134,8 @@ void BufferViewer::data_selected(const QItemSelection &selected, const QItemSele INVOKE_MEMFN(RT_UpdateAndDisplay); } } + +void BufferViewer::on_toggleControls_toggled(bool checked) +{ + ui->cameraControlsGroup->setVisible(checked); +} diff --git a/qrenderdoc/Windows/BufferViewer.h b/qrenderdoc/Windows/BufferViewer.h index 839c145b4..ff0cdd6f7 100644 --- a/qrenderdoc/Windows/BufferViewer.h +++ b/qrenderdoc/Windows/BufferViewer.h @@ -33,6 +33,9 @@ class BufferViewer; } class BufferItemModel; +class CameraWrapper; +class ArcballWrapper; +class FlycamWrapper; class BufferViewer : public QFrame, public ILogViewerForm { @@ -50,12 +53,15 @@ public: private slots: // automatic slots void on_outputTabs_currentChanged(int index); + void on_toggleControls_toggled(bool checked); // manual slots void render_mouseMove(QMouseEvent *e); void render_clicked(QMouseEvent *e); void render_mouseWheel(QWheelEvent *e); void render_keyPress(QKeyEvent *e); + void render_keyRelease(QKeyEvent *e); + void render_timer(); void data_selected(const QItemSelection &selected, const QItemSelection &deselected); private: @@ -70,13 +76,13 @@ private: MeshDisplay m_ConfigVSOut; MeshDisplay *m_curConfig; - QPoint m_PrevPos; - FloatVector m_pos, m_rot; - float m_CamDist; + CameraWrapper *m_CurrentCamera = NULL; + ArcballWrapper *m_Arcball = NULL; + FlycamWrapper *m_Flycam = NULL; BufferItemModel *m_ModelVSIn; BufferItemModel *m_ModelVSOut; - // BufferItemModel *m_ModelGSOut; + BufferItemModel *m_ModelGSOut; void Reset(); }; diff --git a/qrenderdoc/Windows/BufferViewer.ui b/qrenderdoc/Windows/BufferViewer.ui index 6be01197b..8ff6235c2 100644 --- a/qrenderdoc/Windows/BufferViewer.ui +++ b/qrenderdoc/Windows/BufferViewer.ui @@ -6,125 +6,760 @@ 0 0 - 612 - 429 + 761 + 537 Buffer Viewer - - - - - QAbstractItemView::NoEditTriggers - - - false - - - false - - - QAbstractItemView::SingleSelection - - - QAbstractItemView::SelectRows - - - QAbstractItemView::ScrollPerPixel - - - false - - - false - - - false - - - - - - - QAbstractItemView::NoEditTriggers - - - false - - - false - - - QAbstractItemView::SingleSelection - - - QAbstractItemView::SelectRows - - - QAbstractItemView::ScrollPerPixel - - - false - - - false - - - false - - - - - - + + + + 60 + 50 + 194 + 91 + + + + QAbstractItemView::NoEditTriggers + + + false + + + false + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + QAbstractItemView::ScrollPerPixel + + + false + + + false + + + false + + + + + + 280 + 50 + 194 + 101 + + + + QAbstractItemView::NoEditTriggers + + + false + + + false + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + QAbstractItemView::ScrollPerPixel + + + false + + + false + + + false + + + + + + 50 + 220 + 666 + 312 + + + + 0 + + + + VS In + + + 0 - - - VS In - - - - 2 - - - 2 - - - 2 - - - 2 - - - - - + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 4 + + + 2 + + + 4 + + + 2 + + + 6 + + + + + + 0 + 0 + + + + + 0 + 28 + + + + + 2 + + + 0 + + + 0 + + + 6 + + + 0 + + + + + true + + + + :/Resources/cog.png:/Resources/cog.png + + + true + + + false + + + true + + + + + + + true + + + + + + + :/Resources/arrow_undo.png:/Resources/arrow_undo.png + + + true + + + + + + + true + + + + + + + :/Resources/wand.png:/Resources/wand.png + + + true + + + + + + + + + + Qt::Vertical + + + + + + + + + + Qt::Vertical + + + + + + + Solid Shading + + + + + + + + + + true + + + + 0 + 0 + + + + Wireframe + + + true + + + true + + + Qt::ToolButtonTextOnly + + + true + + + + + + + true + + + + 0 + 0 + + + + Highlight Vertices + + + + :/Resources/asterisk_orange.png:/Resources/asterisk_orange.png + + + true + + + true + + + Qt::ToolButtonTextBesideIcon + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + 0 + 0 + + + + Camera Controls + + + + + + + + + + + + + + + Far Plane: + + + + + + + 5 + + + 0.000100000000000 + + + 100.000000000000000 + + + 0.000100000000000 + + + 1.000000000000000 + + + + + + + Near Plane: + + + + + + + Aspect Ratio: + + + + + + + Persp. FOV: + + + + + + + Speed: + + + + + + + 2 + + + 2 + + + QComboBox::NoInsert + + + true + + + + + + + Manually set auto-guessed values +Blank to use automatic value + + + + + + + D00 + + + + + + + Matrix Type: + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + 0 + 0 + + + + + + + + + + + + VS Out + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + GS Out + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + 500 + 50 + 194 + 81 + + + + QAbstractItemView::NoEditTriggers + + + false + + + false + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + QAbstractItemView::ScrollPerPixel + + + false + + + false + + + false + + + + + + 50 + 10 + 435 + 28 + + + + + 0 + 0 + + + + + 0 + 28 + + + + QFrame::Panel + + + QFrame::Raised + + + + 2 + + + 6 + + + 2 + + + 6 + + + 2 + + + + + Controls + - - - VS Out - - - - 2 - - - 2 - - - 2 - - - 2 - - + + + + + Qt::Vertical + - - - + + + + + true + + + + :/Resources/save.png:/Resources/save.png + + + false + + + false + + + QToolButton::MenuButtonPopup + + + true + + + + + + + true + + + Sync Views + + + + :/Resources/arrow_join.png:/Resources/arrow_join.png + + + true + + + false + + + Qt::ToolButtonTextBesideIcon + + + true + + + + + + + Qt::Vertical + + + + + + + Row Offset + + + + + + + + + + 1000000 + + + + + + + Qt::Vertical + + + + + + + Instance + + + + + + + 100000 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + 30 + 50 + 119 + 100 + + + + + 0 + 0 + + + + + 100 + 100 + + + + false + + + + + + 139 + 160 + 521 + 61 + + + + + 0 + 0 + + + @@ -137,7 +772,20 @@ QTableView
Widgets/Extended/RDTableView.h
+ + ToolWindowManager + QWidget +
ToolWindowManager.h
+
+ + BufferFormatSpecifier + QWidget +
Widgets/BufferFormatSpecifier.h
+ 1 +
- + + +