Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
RenderStats.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 RenderStats final
12{
13public:
14 using IntegerType = int64;
15 using RealType = float32;
16
17 constexpr static std::size_t NUM_INTEGERS = 4;
18 constexpr static std::size_t NUM_REALS = 4;
19
20 enum class EType
21 {
22 INTEGER,
23 REAL
24 };
25
26 RenderStats() = default;
27
28 IntegerType getInteger(std::size_t index) const;
29 RealType getReal(std::size_t index) const;
30
31 void setInteger(std::size_t index, IntegerType value);
32 void setReal(std::size_t index, RealType value);
33
34 constexpr static std::size_t numStats(EType type);
35
36private:
37 IntegerType m_integers[NUM_INTEGERS];
38 RealType m_reals[NUM_REALS];
39};
40
41// In-header Implementations:
42
43inline auto RenderStats::getInteger(const std::size_t index) const -> IntegerType
44{
45 PH_ASSERT_LT(index, NUM_INTEGERS);
46
47 return m_integers[index];
48}
49
50inline auto RenderStats::getReal(const std::size_t index) const -> RealType
51{
52 PH_ASSERT_LT(index, NUM_REALS);
53
54 return m_reals[index];
55}
56
57inline void RenderStats::setInteger(const std::size_t index, const IntegerType value)
58{
59 PH_ASSERT_LT(index, NUM_INTEGERS);
60
61 m_integers[index] = value;
62}
63
64inline void RenderStats::setReal(const std::size_t index, const RealType value)
65{
66 PH_ASSERT_LT(index, NUM_REALS);
67
68 m_reals[index] = value;
69}
70
71inline constexpr std::size_t RenderStats::numStats(const EType type)
72{
73 if(type == EType::INTEGER)
74 {
75 return NUM_INTEGERS;
76 }
77 else
78 {
79 return NUM_REALS;
80 }
81}
82
83}// end namespace ph
Definition RenderStats.h:12
int64 IntegerType
Definition RenderStats.h:14
EType
Definition RenderStats.h:21
float32 RealType
Definition RenderStats.h:15
IntegerType getInteger(std::size_t index) const
Definition RenderStats.h:43
RenderStats()=default
static constexpr std::size_t NUM_INTEGERS
Definition RenderStats.h:17
static constexpr std::size_t numStats(EType type)
Definition RenderStats.h:71
void setInteger(std::size_t index, IntegerType value)
Definition RenderStats.h:57
void setReal(std::size_t index, RealType value)
Definition RenderStats.h:64
RealType getReal(std::size_t index) const
Definition RenderStats.h:50
static constexpr std::size_t NUM_REALS
Definition RenderStats.h:18
The root for all renderer implementations.
Definition EEngineProject.h:6