Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
RenderProgress.h
Go to the documentation of this file.
1#pragma once
2
3#include <Common/assertion.h>
4#include <Common/primitive_type.h>
5
6#include <cstddef>
7
8namespace ph
9{
10
11class RenderProgress final
12{
13public:
17
19 uint64 totalWork,
20 uint64 workDone,
21 uint64 elapsedMs);
22
23 uint64 getTotalWork() const;
24 uint64 getWorkDone() const;
25
30 uint64 getElapsedMs() const;
31
32 real getNormalizedProgress() const;
33 real getPercentageProgress() const;
34
36
37private:
38 uint64 m_totalWork;
39 uint64 m_workDone;
40 uint64 m_elapsedMs;
41};
42
43// In-header Implementations:
44
48
50 const uint64 totalWork,
51 const uint64 workDone,
52 const uint64 elapsedMs) :
53 m_totalWork(totalWork),
54 m_workDone(workDone),
55 m_elapsedMs(elapsedMs)
56{}
57
58inline uint64 RenderProgress::getTotalWork() const
59{
60 return m_totalWork;
61}
62
63inline uint64 RenderProgress::getWorkDone() const
64{
65 return m_workDone;
66}
67
68inline uint64 RenderProgress::getElapsedMs() const
69{
70 return m_elapsedMs;
71}
72
74{
75 if(m_totalWork != 0)
76 {
77 return static_cast<real>(m_workDone) / static_cast<real>(m_totalWork);
78 }
79 else
80 {
81 return 0.0_r;
82 }
83}
84
86{
87 return getNormalizedProgress() * 100.0_r;
88}
89
91{
92 m_totalWork += rhs.m_totalWork;
93 m_workDone += rhs.m_workDone;
94 m_elapsedMs += rhs.m_elapsedMs;
95
96 return *this;
97}
98
99}// end namespace ph
Definition RenderProgress.h:12
RenderProgress()
Represents no progress.
Definition RenderProgress.h:45
uint64 getTotalWork() const
Definition RenderProgress.h:58
uint64 getWorkDone() const
Definition RenderProgress.h:63
real getPercentageProgress() const
Definition RenderProgress.h:85
real getNormalizedProgress() const
Definition RenderProgress.h:73
uint64 getElapsedMs() const
Definition RenderProgress.h:68
RenderProgress & operator+=(const RenderProgress &rhs)
Definition RenderProgress.h:90
The root for all renderer implementations.
Definition EEngineProject.h:6