forked from mitsuba-renderer/mitsuba3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprogress.h
45 lines (37 loc) · 1.17 KB
/
progress.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
#pragma once
#include <mitsuba/core/timer.h>
#include <mitsuba/core/object.h>
NAMESPACE_BEGIN(mitsuba)
/**
* \brief General-purpose progress reporter
*
* This class is used to track the progress of various operations that might
* take longer than a second or so. It provides interactive feedback when
* Mitsuba is run on the console, via the OpenGL GUI, or in Jupyter Notebook.
*/
class MI_EXPORT_LIB ProgressReporter : public Object {
public:
/**
* \brief Construct a new progress reporter.
* \param label
* An identifying name for the operation taking place (e.g. "Rendering")
* \param ptr
* Custom pointer payload to be delivered as part of progress messages
*/
ProgressReporter(const std::string &label, void *payload = nullptr);
/// Destructor
~ProgressReporter();
/// Update the progress to \c progress (which should be in the range [0, 1])
void update(float progress);
MI_DECLARE_CLASS()
protected:
Timer m_timer;
std::string m_label;
std::string m_line;
size_t m_bar_start;
size_t m_bar_size;
size_t m_last_update;
float m_last_progress;
void *m_payload;
};
NAMESPACE_END(mitsuba)