Plasma Engine  2.0
Loading...
Searching...
No Matches
FogComponent.h
1#pragma once
2
3#include <Core/World/SettingsComponent.h>
4#include <Core/World/SettingsComponentManager.h>
5#include <RendererCore/Pipeline/RenderData.h>
6
8
10
12class PL_RENDERERCORE_DLL plFogRenderData : public plRenderData
13{
14 PL_ADD_DYNAMIC_REFLECTION(plFogRenderData, plRenderData);
15
16public:
17 plColor m_Color;
18 float m_fDensity;
19 float m_fHeightFalloff;
20 float m_fInvSkyDistance;
21};
22
23class PL_RENDERERCORE_DLL plFogComponent : public plSettingsComponent
24{
25 PL_DECLARE_COMPONENT_TYPE(plFogComponent, plSettingsComponent, plFogComponentManager);
26
28 // plComponent
29
30public:
31 virtual void SerializeComponent(plWorldWriter& inout_stream) const override;
32 virtual void DeserializeComponent(plWorldReader& inout_stream) override;
33
34protected:
35 virtual void Deinitialize() override;
36 virtual void OnActivated() override;
37 virtual void OnDeactivated() override;
38
39
41 // plFogComponent
42
43public:
46
47 void SetColor(plColor color); // [ property ]
48 plColor GetColor() const; // [ property ]
49
50 void SetDensity(float fDensity); // [ property ]
51 float GetDensity() const; // [ property ]
52
53 void SetHeightFalloff(float fHeightFalloff); // [ property ]
54 float GetHeightFalloff() const; // [ property ]
55
56 void SetModulateWithSkyColor(bool bModulate); // [ property ]
57 bool GetModulateWithSkyColor() const; // [ property ]
58
59 void SetSkyDistance(float fDistance); // [ property ]
60 float GetSkyDistance() const; // [ property ]
61
62protected:
63 void OnUpdateLocalBounds(plMsgUpdateLocalBounds& msg);
64 void OnMsgExtractRenderData(plMsgExtractRenderData& msg) const;
65
66 plColor m_Color = plColor(0.2f, 0.2f, 0.3f);
67 float m_fDensity = 1.0f;
68 float m_fHeightFalloff = 10.0f;
69 float m_fSkyDistance = 1000.0f;
70 bool m_bModulateWithSkyColor = false;
71};
plColor represents an RGBA color in linear color space. Values are stored as float,...
Definition Color.h:44
Definition FogComponent.h:24
The render data object for ambient light.
Definition FogComponent.h:13
Base class for all render data. Render data must contain all information that is needed to render the...
Definition RenderData.h:14
Base class for settings components, of which only one per type should exist in each world.
Definition SettingsComponent.h:13
A component manager that does no update at all on components and expects only a single instance to be...
Definition SettingsComponentManager.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
Definition RenderData.h:116
Definition UpdateLocalBoundsMessage.h:9