Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
PrimitiveMetadata.h
Go to the documentation of this file.
1#pragma once
2
8
9#include <Common/assertion.h>
10
11#include <memory>
12#include <vector>
13
14namespace ph
15{
16
22{
23public:
24 static constexpr auto INVALID_CHANNEL_ID = static_cast<uint8>(-1);
25 static constexpr auto DEFAULT_CHANNEL_ID = static_cast<uint8>( 0);
26
28
32 uint8 addChannel(const PrimitiveChannel& channel);
33
34 void setChannel(uint8 channelId, PrimitiveChannel channel);
35 const PrimitiveChannel& getChannel(uint8 channelId) const;
37 bool isChannelIdValid(uint8 channelId) const;
38
42
43 const SurfaceBehavior& getSurface() const;
44 const VolumeBehavior& getInterior() const;
45 const VolumeBehavior& getExterior() const;
46
47private:
48 SurfaceBehavior m_surface;
49 VolumeBehavior m_interior;
50 VolumeBehavior m_exterior;
51 std::vector<PrimitiveChannel> m_channels;
52};
53
54inline const PrimitiveChannel& PrimitiveMetadata::getChannel(const uint8 channelId) const
55{
56 if(isChannelIdValid(channelId))
57 {
58 return m_channels[channelId];
59 }
60 else
61 {
62 return getDefaultChannel();
63 }
64}
65
70
71inline bool PrimitiveMetadata::isChannelIdValid(const uint8 channelId) const
72{
73 return channelId < m_channels.size();
74}
75
77{
78 return m_surface;
79}
80
82{
83 return m_interior;
84}
85
87{
88 return m_exterior;
89}
90
92{
93 return m_surface;
94}
95
97{
98 return m_interior;
99}
100
102{
103 return m_exterior;
104}
105
106}// end namespace ph
Definition PrimitiveChannel.h:17
Collection of attached components to a primitive. This type effectively "glues" various components th...
Definition PrimitiveMetadata.h:22
PrimitiveMetadata()
Definition PrimitiveMetadata.cpp:15
VolumeBehavior & getInterior()
Definition PrimitiveMetadata.h:81
const PrimitiveChannel & getDefaultChannel() const
Definition PrimitiveMetadata.h:66
static constexpr auto INVALID_CHANNEL_ID
Definition PrimitiveMetadata.h:24
const PrimitiveChannel & getChannel(uint8 channelId) const
Definition PrimitiveMetadata.h:54
static constexpr auto DEFAULT_CHANNEL_ID
Definition PrimitiveMetadata.h:25
void setChannel(uint8 channelId, PrimitiveChannel channel)
Definition PrimitiveMetadata.cpp:36
SurfaceBehavior & getSurface()
Definition PrimitiveMetadata.h:76
uint8 addChannel(const PrimitiveChannel &channel)
Adds a channel to the metadata.
Definition PrimitiveMetadata.cpp:25
bool isChannelIdValid(uint8 channelId) const
Definition PrimitiveMetadata.h:71
VolumeBehavior & getExterior()
Definition PrimitiveMetadata.h:86
Definition SurfaceBehavior.h:15
Definition VolumeBehavior.h:13
The root for all renderer implementations.
Definition EEngineProject.h:6