Plasma Engine  2.0
Loading...
Searching...
No Matches
ReflectionProbeData.h
1#pragma once
2
3#include <Foundation/Reflection/Reflection.h>
4#include <Foundation/Types/TagSet.h>
5#include <RendererCore/Declarations.h>
6#include <RendererCore/Pipeline/RenderData.h>
7
9{
10 using StorageType = plUInt8;
11
12 enum Enum
13 {
14 Static,
15 Dynamic,
16
17 Default = Static
18 };
19};
20PL_DECLARE_REFLECTABLE_TYPE(PL_RENDERERCORE_DLL, plReflectionProbeMode);
21
23struct PL_RENDERERCORE_DLL plReflectionProbeDesc
24{
25 plUuid m_uniqueID;
26
27 plTagSet m_IncludeTags;
28 plTagSet m_ExcludeTags;
29
31
32 bool m_bShowDebugInfo = false;
33 bool m_bShowMipMaps = false;
34
35 float m_fIntensity = 1.0f;
36 float m_fSaturation = 1.0f;
37 float m_fNearPlane = 0.0f;
38 float m_fFarPlane = 100.0f;
39 plVec3 m_vCaptureOffset = plVec3::MakeZero();
40};
41
43
44template <>
46{
47 PL_ALWAYS_INLINE static plUInt32 Hash(plReflectionProbeId value) { return plHashHelper<plUInt32>::Hash(value.m_Data); }
48
49 PL_ALWAYS_INLINE static bool Equal(plReflectionProbeId a, plReflectionProbeId b) { return a == b; }
50};
51
53class PL_RENDERERCORE_DLL plReflectionProbeRenderData : public plRenderData
54{
55 PL_ADD_DYNAMIC_REFLECTION(plReflectionProbeRenderData, plRenderData);
56
57public:
59 {
60 m_Id.Invalidate();
61 m_vHalfExtents.SetZero();
62 }
63
65 plUInt32 m_uiIndex = 0;
67 plVec3 m_vHalfExtents;
68 plVec3 m_vPositiveFalloff;
69 plVec3 m_vNegativeFalloff;
70 plVec3 m_vInfluenceScale;
71 plVec3 m_vInfluenceShift;
72};
73
76{
77 bool operator==(const plReflectionProbeRef& b) const
78 {
79 return m_Id == b.m_Id && m_uiWorldIndex == b.m_uiWorldIndex;
80 }
81
82 plUInt32 m_uiWorldIndex = 0;
84};
85static_assert(sizeof(plReflectionProbeRef) == 8);
86
87template <>
89{
90 PL_ALWAYS_INLINE static plUInt32 Hash(plReflectionProbeRef value) { return plHashHelper<plUInt64>::Hash(reinterpret_cast<plUInt64&>(value)); }
91
92 PL_ALWAYS_INLINE static bool Equal(plReflectionProbeRef a, plReflectionProbeRef b) { return a.m_Id == b.m_Id && a.m_uiWorldIndex == b.m_uiWorldIndex; }
93};
94
97{
98 using StorageType = plUInt8;
99
100 enum Enum
101 {
102 SkyLight = PL_BIT(0),
103 HasCustomCubeMap = PL_BIT(1),
104 Sphere = PL_BIT(2),
105 Box = PL_BIT(3),
106 Dynamic = PL_BIT(4),
107 Default = 0
108 };
109
110 struct Bits
111 {
112 StorageType SkyLight : 1;
113 StorageType HasCustomCubeMap : 1;
114 StorageType Sphere : 1;
115 StorageType Box : 1;
116 StorageType Dynamic : 1;
117 };
118};
119
120PL_DECLARE_FLAGS_OPERATORS(plProbeFlags);
121
122PL_DECLARE_REFLECTABLE_TYPE(PL_RENDERERCORE_DLL, plProbeFlags);
Render data for a reflection probe.
Definition ReflectionProbeData.h:54
plVec3 m_vProbePosition
Probe position in world space.
Definition ReflectionProbeData.h:66
Base class for all render data. Render data must contain all information that is needed to render the...
Definition RenderData.h:14
A dynamic collection of tags featuring fast lookups.
Definition TagSet.h:23
This data type is the abstraction for 128-bit Uuid (also known as GUID) instances.
Definition Uuid.h:11
static plVec3Template< float > MakeZero()
Definition Vec3.h:38
A custom enum implementation that allows to define the underlying storage type to control its memory ...
Definition Enum.h:37
Helper struct to calculate the Hash of different types.
Definition HashingUtils.h:75
Definition ReflectionProbeData.h:111
Flags that describe a reflection probe.
Definition ReflectionProbeData.h:97
Describes how a cube map should be generated.
Definition ReflectionProbeData.h:24
Definition ReflectionProbeData.h:9
A unique reference to a reflection probe.
Definition ReflectionProbeData.h:76