Plasma Engine  2.0
Loading...
Searching...
No Matches
AtmosphericScatteringComponent.h
1#pragma once
2
3#include <Core/World/World.h>
4#include <RendererCore/Meshes/MeshComponent.h>
5
7
8class PL_RENDERERCORE_DLL plAtmosphericScatteringComponent : public plRenderComponent
9{
11
13 // plComponent
14
15public:
16 virtual void SerializeComponent(plWorldWriter& inout_stream) const override;
17 virtual void DeserializeComponent(plWorldReader& inout_stream) override;
18
19protected:
20 virtual void Initialize() override;
21 virtual void OnActivated() override;
22
23
25 // plRenderComponent
26
27public:
28 virtual plResult GetLocalBounds(plBoundingBoxSphere& ref_bounds, bool& ref_bAlwaysVisible, plMsgUpdateLocalBounds& ref_msg) override;
29
30 void SetPlanetRadius(float fPlanetRadius);
31 float GetPlanetRadius() const;
32
33 void SetAtmosphereRadius(float fAtmosphereRadius);
34 float GetAtmosphereRadius() const;
35
36 void SetRayleighScattering(plColor RayleighScattering);
37 plColor GetRayleighScattering() const;
38
39 void SetMieScattering(plColor MieScattering);
40 plColor GetMieScattering() const;
41
42 void SetAbsorption(plColor Absorption);
43 plColor GetAbsorption() const;
44
45 void SetAmbientScattering(plColor AmbientScattering);
46 plColor GetAmbientScattering() const;
47
48 void SetMieScatterDirection(float MieScatterDirection);
49 float GetMieScatterDirection() const;
50
51 void SetRayleighHeight(float fRayleighHeight);
52 float GetRayleighHeight() const;
53
54 void SetMieHeight(float fMieHeight);
55 float GetMieHeight() const;
56
57 void SetAbsorptionHeight(float fAbsorptionHeight);
58 float GetAbsorptionHeight() const;
59
60 void SetAbsorptionFalloff(float fAbsorptionFalloff);
61 float GetAbsorptionFalloff() const;
62
63 void SetRaySteps(float fRaySteps);
64 float GetRaySteps() const;
65
66 void SetLightSteps(float fLightSteps);
67 float GetLightSteps() const;
68
70 // plAtmosphericScatteringComponent
71
72public:
75
76private:
77 void OnMsgExtractRenderData(plMsgExtractRenderData& msg) const;
78 void UpdateMaterials() const;
79
81 plMaterialResourceHandle m_hMaterial;
82
83 float m_fPlanetRadius;
84 float m_fAtmosphereRadius;
85 plColor m_RayleighScattering;
86 plColor m_MieScattering;
87 plColor m_Absorption;
88 plColor m_AmbientScattering;
89 float m_fMieScatterDirection;
90 float m_fRayleighHeight;
91 float m_fMieHeight;
92 float m_fAbsorptionHeight;
93 float m_fAbsorptionFalloff;
94 float m_fRaySteps;
95 float m_fLightSteps;
96};
Definition AtmosphericScatteringComponent.h:9
plColor represents an RGBA color in linear color space. Values are stored as float,...
Definition Color.h:44
virtual void SerializeComponent(plWorldWriter &inout_stream) const
Override this to save the current state of the component to the given stream.
Definition Component.cpp:54
virtual void DeserializeComponent(plWorldReader &inout_stream)
Override this to load the current state of the component from the given stream.
Definition Component.cpp:58
virtual void Initialize()
Can be overridden for basic initialization that depends on a valid hierarchy and position.
Definition Component.cpp:131
Definition ComponentManager.h:88
Base class for objects that should be rendered.
Definition RenderComponent.h:9
virtual void OnActivated() override
This method is called when the component gets activated.
Definition RenderComponent.cpp:33
virtual plResult GetLocalBounds(plBoundingBoxSphere &ref_bounds, bool &ref_bAlwaysVisible, plMsgUpdateLocalBounds &ref_msg)=0
Called by plRenderComponent::OnUpdateLocalBounds(). If PL_SUCCESS is returned, bounds and bAlwaysVisi...
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
Default enum for returning failure or success, instead of using a bool.
Definition Types.h:54