Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
SdlOutputClauses.h
Go to the documentation of this file.
1#pragma once
2
4
5#include <Common/assertion.h>
6
7#include <cstddef>
8#include <vector>
9
10namespace ph
11{
12
14{
15public:
17
19 void clear();
20
21 std::size_t numClauses() const;
22 const SdlOutputClause& operator [] (std::size_t clauseIdx) const;
23
24private:
25 std::vector<SdlOutputClause> m_clauseBuffer;
26 std::size_t m_numUsedClauses;
27};
28
30 m_clauseBuffer(),
31 m_numUsedClauses(0)
32{}
33
35{
36 // Increase buffer size if there is not enough clauses
37 if(m_numUsedClauses == m_clauseBuffer.size())
38 {
39 m_clauseBuffer.push_back(SdlOutputClause());
40 }
41
42 PH_ASSERT_LT(m_numUsedClauses, m_clauseBuffer.size());
43 SdlOutputClause& newClause = m_clauseBuffer[m_numUsedClauses++];
44
45 // Clear clause data as it may be used
46 newClause.clear();
47
48 return newClause;
49}
50
52{
53 m_numUsedClauses = 0;
54}
55
56inline std::size_t SdlOutputClauses::numClauses() const
57{
58 PH_ASSERT_LE(m_numUsedClauses, m_clauseBuffer.size());
59 return m_numUsedClauses;
60}
61
62inline const SdlOutputClause& SdlOutputClauses::operator [] (const std::size_t clauseIdx) const
63{
64 PH_ASSERT_LT(clauseIdx, numClauses());
65 return m_clauseBuffer[clauseIdx];
66}
67
68}// end namespace ph
Carries SDL representation of various data during the output process. Helps to write output data such...
Definition SdlOutputClause.h:14
void clear()
Definition SdlOutputClause.h:58
Definition SdlOutputClauses.h:14
SdlOutputClause & createClause()
Definition SdlOutputClauses.h:34
std::size_t numClauses() const
Definition SdlOutputClauses.h:56
void clear()
Definition SdlOutputClauses.h:51
SdlOutputClauses()
Definition SdlOutputClauses.h:29
const SdlOutputClause & operator[](std::size_t clauseIdx) const
Definition SdlOutputClauses.h:62
The root for all renderer implementations.
Definition EEngineProject.h:6