Plasma Engine  2.0
Loading...
Searching...
No Matches
LightComponent.h
1#pragma once
2
3#include <RendererCore/Components/RenderComponent.h>
4#include <RendererCore/Pipeline/RenderData.h>
5
6struct plMsgSetColor;
7
9class PL_RENDERERCORE_DLL plLightRenderData : public plRenderData
10{
11 PL_ADD_DYNAMIC_REFLECTION(plLightRenderData, plRenderData);
12
13public:
14 void FillBatchIdAndSortingKey(float fScreenSpaceSize);
15
16 plColor m_LightColor;
17 float m_fIntensity;
18 float m_fSpecularMultiplier;
19 plUInt32 m_uiShadowDataOffset;
20 float m_fWidth;
21 float m_fLength;
22};
23
25class PL_RENDERERCORE_DLL plLightComponent : public plRenderComponent
26{
27 PL_DECLARE_ABSTRACT_COMPONENT_TYPE(plLightComponent, plRenderComponent);
28
30 // plComponent
31
32public:
33 virtual void SerializeComponent(plWorldWriter& inout_stream) const override;
34 virtual void DeserializeComponent(plWorldReader& inout_stream) override;
35
37 // plLightComponent
38
39public:
42
45 void SetUsingColorTemperature(bool bUseColorTemperature);
46 bool GetUsingColorTemperature() const;
47
48 void SetLightColor(plColorGammaUB lightColor); // [ property ]
49 plColorGammaUB GetBaseLightColor() const; // [ property ]
50
51 plColorGammaUB GetLightColor() const;
52
53 void SetTemperature(plUInt32 uiTemperature); // [ property ]
54 plUInt32 GetTemperature() const; // [ property ]
55
57 void SetIntensity(float fIntensity); // [ property ]
58 float GetIntensity() const; // [ property ]
59
60 void SetSpecularMultiplier(float fSpecularMultiplier); // [ property ]
61 float GetSpecularMultiplier() const; // [ property ]
62
64 void SetCastShadows(bool bCastShadows); // [ property ]
65 bool GetCastShadows() const; // [ property ]
66
68 void SetPenumbraSize(float fPenumbraSize); // [ property ]
69 float GetPenumbraSize() const; // [ property ]
70
72 void SetSlopeBias(float fShadowBias); // [ property ]
73 float GetSlopeBias() const; // [ property ]
74
76 void SetConstantBias(float fShadowBias); // [ property ]
77 float GetConstantBias() const; // [ property ]
78
80 void SetWidth(float fWidth); // [ property ]
81 float GetWidth() const; // [ property ]
82
84 void SetLength(float fLength); // [ property ]
85 float GetLength() const; // [ property ]
86
87 void OnMsgSetColor(plMsgSetColor& ref_msg); // [ msg handler ]
88
93 static float CalculateEffectiveRange(float fRange, float fIntensity, float fWidth = 0.0f, float fLength = 0.0f);
94
96 static float CalculateScreenSpaceSize(const plBoundingSphere& sphere, const plCamera& camera);
97
98protected:
99 plColorGammaUB m_LightColor = plColor::White;
100 plUInt32 m_uiTemperature = 6550;
101 float m_fIntensity = 10.0f;
102 float m_fSpecularMultiplier = 1.0f;
103 float m_fPenumbraSize = 0.1f;
104 float m_fSlopeBias = 0.25f;
105 float m_fConstantBias = 0.1f;
106 bool m_bCastShadows = false;
107 bool m_bUseColorTemperature = false;
108 float m_fWidth;
109 float m_fLength;
110};
A camera class that stores the orientation and some basic camera settings.
Definition Camera.h:41
A 8bit per channel unsigned normalized (values interpreted as 0-1) color storage format that represen...
Definition Color8UNorm.h:99
plColor represents an RGBA color in linear color space. Values are stored as float,...
Definition Color.h:44
static const plColor White
#FFFFFF
Definition Color.h:194
Base class for dynamic light components.
Definition LightComponent.h:26
Base class for light render data objects.
Definition LightComponent.h:10
Base class for objects that should be rendered.
Definition RenderComponent.h:9
Base class for all render data. Render data must contain all information that is needed to render the...
Definition RenderData.h:14
Reads a world description from a stream. Allows to instantiate that world multiple times in different...
Definition WorldReader.h:47
Stores an entire plWorld in a stream.
Definition WorldWriter.h:13
A message to modify the main color of some thing.
Definition SetColorMessage.h:32