mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 01:20:42 +00:00
Add CustomPaintWidget and super-super hacky initial 'rendering' test
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
#include "CustomPaintWidget.h"
|
||||
#include <QPainter>
|
||||
|
||||
#include "renderdoc_replay.h"
|
||||
|
||||
extern ReplayOutput *out;
|
||||
extern TextureDisplay d;
|
||||
|
||||
CustomPaintWidget::CustomPaintWidget(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
setAttribute(Qt::WA_PaintOnScreen);
|
||||
}
|
||||
|
||||
CustomPaintWidget::~CustomPaintWidget()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CustomPaintWidget::paintEvent(QPaintEvent *e)
|
||||
{
|
||||
static float t = 0.0f;
|
||||
t += 0.01f;
|
||||
d.scale = 1.5f + sinf(t);
|
||||
ReplayOutput_SetTextureDisplay(out, d);
|
||||
ReplayOutput_Display(out);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
#ifndef CUSTOMPAINTWIDGET_H
|
||||
#define CUSTOMPAINTWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class CustomPaintWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CustomPaintWidget(QWidget *parent = 0);
|
||||
~CustomPaintWidget();
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *e);
|
||||
QPaintEngine *paintEngine() const { return NULL; }
|
||||
};
|
||||
|
||||
#endif // CUSTOMPAINTWIDGET_H
|
||||
@@ -19,25 +19,15 @@
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>9</x>
|
||||
<y>9</y>
|
||||
<width>441</width>
|
||||
<height>311</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Placeholder for Event Browser</string>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Placeholder for Event Browser</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
||||
+10
-10
@@ -4,28 +4,28 @@
|
||||
#include "ui_MainWindow.h"
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::MainWindow)
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::MainWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->setupUi(this);
|
||||
|
||||
EventBrowser *eventbrowser = new EventBrowser();
|
||||
EventBrowser *eventbrowser = new EventBrowser();
|
||||
|
||||
ui->toolWindowManager->addToolWindow(eventbrowser, ToolWindowManager::EmptySpace);
|
||||
ui->toolWindowManager->addToolWindow(eventbrowser, ToolWindowManager::EmptySpace);
|
||||
|
||||
TextureViewer *textureviewer = new TextureViewer();
|
||||
TextureViewer *textureviewer = new TextureViewer();
|
||||
|
||||
ui->toolWindowManager->addToolWindow(textureviewer, ToolWindowManager::AreaReference(ToolWindowManager::RightOf, ui->toolWindowManager->areaOf(eventbrowser)));
|
||||
ui->toolWindowManager->addToolWindow(textureviewer, ToolWindowManager::AreaReference(ToolWindowManager::RightOf, ui->toolWindowManager->areaOf(eventbrowser)));
|
||||
|
||||
ui->toolWindowManager->setRubberBandLineWidth(50);
|
||||
ui->toolWindowManager->setRubberBandLineWidth(50);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
delete ui;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void MainWindow::on_action_Exit_triggered()
|
||||
{
|
||||
this->close();
|
||||
this->close();
|
||||
}
|
||||
|
||||
@@ -1,11 +1,62 @@
|
||||
#include "TextureViewer.h"
|
||||
#include "ui_TextureViewer.h"
|
||||
|
||||
#include "renderdoc_replay.h"
|
||||
|
||||
ReplayOutput *out = NULL;
|
||||
TextureDisplay d;
|
||||
|
||||
TextureViewer::TextureViewer(QWidget *parent) :
|
||||
QFrame(parent),
|
||||
ui(new Ui::TextureViewer)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
ReplayRenderer *renderer = NULL;
|
||||
|
||||
float progress = 0.0f;
|
||||
RENDERDOC_CreateReplayRenderer("T:\\renderdoc\\archive_renderdoc_captures\\deferred_plusplus.rdc", &progress, &renderer);
|
||||
|
||||
rdctype::array<FetchTexture> texs;
|
||||
ReplayRenderer_GetTextures(renderer, &texs);
|
||||
|
||||
for(int32_t i=0; i < texs.count; i++)
|
||||
{
|
||||
if(texs[i].creationFlags & eTextureCreate_SwapBuffer)
|
||||
{
|
||||
d.texid = texs[i].ID;
|
||||
d.mip = 0;
|
||||
d.sampleIdx = ~0U;
|
||||
d.overlay = eTexOverlay_None;
|
||||
d.CustomShader = ResourceId();
|
||||
d.HDRMul = -1.0f;
|
||||
d.linearDisplayAsGamma = true;
|
||||
d.FlipY = false;
|
||||
d.rangemin = 0.0f;
|
||||
d.rangemax = 1.0f;
|
||||
d.scale = 1.0f;
|
||||
d.offx = 0.0f;
|
||||
d.offy = 0.0f;
|
||||
d.sliceFace = 0;
|
||||
d.rawoutput = false;
|
||||
d.lightBackgroundColour = d.darkBackgroundColour =
|
||||
FloatVector(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
d.Red = d.Green = d.Blue = true;
|
||||
d.Alpha = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
HWND wnd = (HWND)ui->framerender->winId();
|
||||
|
||||
out = ReplayRenderer_CreateOutput(renderer, wnd);
|
||||
|
||||
OutputConfig c = { eOutputType_TexDisplay };
|
||||
|
||||
ReplayOutput_SetOutputConfig(out, c);
|
||||
ReplayOutput_SetTextureDisplay(out, d);
|
||||
|
||||
ReplayRenderer_SetFrameEvent(renderer, 0, 10000000+rand()%1000);
|
||||
}
|
||||
|
||||
TextureViewer::~TextureViewer()
|
||||
|
||||
+23
-15
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
<width>513</width>
|
||||
<height>494</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -19,20 +19,28 @@
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>80</x>
|
||||
<y>50</y>
|
||||
<width>211</width>
|
||||
<height>131</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Placeholder for Texture Viewer</string>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Placeholder for Texture Viewer</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="CustomPaintWidget" name="framerender" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>CustomPaintWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>custompaintwidget.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -53,14 +53,16 @@ SOURCES += main.cpp\
|
||||
3rdparty/toolwindowmanager/ToolWindowManagerArea.cpp \
|
||||
3rdparty/toolwindowmanager/ToolWindowManagerWrapper.cpp \
|
||||
EventBrowser.cpp \
|
||||
TextureViewer.cpp
|
||||
TextureViewer.cpp \
|
||||
CustomPaintWidget.cpp
|
||||
|
||||
HEADERS += MainWindow.h \
|
||||
3rdparty/toolwindowmanager/ToolWindowManager.h \
|
||||
3rdparty/toolwindowmanager/ToolWindowManagerArea.h \
|
||||
3rdparty/toolwindowmanager/ToolWindowManagerWrapper.h \
|
||||
EventBrowser.h \
|
||||
TextureViewer.h
|
||||
TextureViewer.h \
|
||||
CustomPaintWidget.h
|
||||
|
||||
FORMS += MainWindow.ui \
|
||||
EventBrowser.ui \
|
||||
|
||||
Reference in New Issue
Block a user