-
Notifications
You must be signed in to change notification settings - Fork 1
/
framebuffer.h
81 lines (57 loc) · 1.48 KB
/
framebuffer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#pragma once
#include "pvl/UniformGrid.hpp"
#include <QFileDialog>
#include <QMainWindow>
#include <QPainter>
#include <QResizeEvent>
#include <memory>
QT_BEGIN_NAMESPACE
namespace Ui {
class FrameBuffer;
}
class QProgressBar;
QT_END_NAMESPACE
struct TaskGroup;
using Image = Pvl::UniformGrid<Pvl::Vec3f, 2>;
class View : public QWidget {
public:
View(QWidget* parent)
: QWidget(parent) {}
virtual void paintEvent(QPaintEvent*) override;
void setTaskGroup(std::shared_ptr<TaskGroup> tg);
void setImage(Image&& image);
void setExposure(int exposure);
void save();
private:
Image image_;
std::shared_ptr<TaskGroup> tg_;
float exposure_ = 1.f;
};
class FrameBufferWidget : public QMainWindow {
Q_OBJECT
public:
FrameBufferWidget(QWidget* parent = nullptr);
~FrameBufferWidget();
void setImage(Image&& image) {
view_->setImage(std::move(image));
}
bool cancelled() const {
return cancelled_;
}
void setProgress(int pass, int prog);
void setNumIters(int numIters);
void run(const std::function<void()>& func);
private slots:
void on_actionSave_render_triggered();
void on_horizontalSlider_valueChanged(int value);
void on_actionClose_triggered();
private:
Ui::FrameBuffer* ui_;
View* view_;
QProgressBar* progressBar_;
QProgressBar* iterationBar_;
int passValue_ = 0;
int progressValue_ = 0;
std::shared_ptr<TaskGroup> tg_;
bool cancelled_ = false;
};