Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
SdlNamedOutputClauses.h
Go to the documentation of this file.
1#pragma once
2
4
5#include <Common/assertion.h>
6#include <Common/Container/StdUnorderedStringSet.h>
7
8#include <cstddef>
9#include <string>
10#include <string_view>
11#include <vector>
12#include <unordered_set>
13
14namespace ph
15{
16
18{
19public:
22 void addUnique(
23 SdlOutputClauses clauses,
24 std::string_view clausesName);
25
28 void addOrUpdate(
29 SdlOutputClauses clauses,
30 std::string_view clausesName);
31
35 std::string_view addOrUpdate(SdlOutputClauses packet);
36
37 void clear();
38
39 std::size_t numNamedOutputClauses() const;
40
45 const std::string& getName(std::size_t index) const;
46 const SdlOutputClauses& getOutputClauses(std::size_t index) const;
48
49private:
50 void add(
51 SdlOutputClauses clauses,
52 std::string_view clausesName);
53
54 struct NamedClauses
55 {
56 std::string name;
57 SdlOutputClauses clauses;
58 };
59
60 std::vector<NamedClauses> m_namedClauses;
61 StdUnorderedStringSet m_clausesNames;
62};
63
65{
66 return m_namedClauses.size();
67}
68
69inline const std::string& SdlNamedOutputClauses::getName(const std::size_t index) const
70{
71 PH_ASSERT_LT(index, m_namedClauses.size());
72
73 return m_namedClauses[index].name;
74}
75
76inline const SdlOutputClauses& SdlNamedOutputClauses::getOutputClauses(const std::size_t index) const
77{
78 PH_ASSERT_LT(index, m_namedClauses.size());
79
80 return m_namedClauses[index].clauses;
81}
82
84{
85 m_namedClauses.clear();
86#if PH_DEBUG
87 m_clausesNames.clear();
88#endif
89}
90
91}// end namespace ph
Definition SdlNamedOutputClauses.h:18
void addOrUpdate(SdlOutputClauses clauses, std::string_view clausesName)
Add a named output clauses. Potentially update the existing one.
Definition SdlNamedOutputClauses.cpp:33
const SdlOutputClauses & getOutputClauses(std::size_t index) const
Definition SdlNamedOutputClauses.h:76
void addUnique(SdlOutputClauses clauses, std::string_view clausesName)
Add a unique named output clauses.
Definition SdlNamedOutputClauses.cpp:13
void clear()
Definition SdlNamedOutputClauses.h:83
std::size_t numNamedOutputClauses() const
Definition SdlNamedOutputClauses.h:64
const std::string & getName(std::size_t index) const
Get named output clauses data. Ordering is the same as how they were added. The ones added later will...
Definition SdlNamedOutputClauses.h:69
Definition SdlOutputClauses.h:14
The root for all renderer implementations.
Definition EEngineProject.h:6