Plasma Engine  2.0
Loading...
Searching...
No Matches
ViewRenderSettings.h
1#pragma once
2
3#include <Core/Graphics/Camera.h>
4#include <EditorEngineProcessFramework/EditorEngineProcessFrameworkDLL.h>
5#include <EditorEngineProcessFramework/IPC/SyncObject.h>
6#include <Foundation/Reflection/Reflection.h>
7#include <RendererCore/Pipeline/ViewRenderMode.h>
8
9struct PL_EDITORENGINEPROCESSFRAMEWORK_DLL plSceneViewPerspective
10{
11 using StorageType = plUInt8;
12
13 enum Enum
14 {
15 Orthogonal_Front,
16 Orthogonal_Right,
17 Orthogonal_Top,
18 Perspective,
19
20 Default = Perspective
21 };
22};
23PL_DECLARE_REFLECTABLE_TYPE(PL_EDITORENGINEPROCESSFRAMEWORK_DLL, plSceneViewPerspective);
24
25struct PL_EDITORENGINEPROCESSFRAMEWORK_DLL plEngineViewConfig
26{
28 {
29 m_RenderMode = plViewRenderMode::Default;
30 m_Perspective = plSceneViewPerspective::Default;
31 m_CameraUsageHint = plCameraUsageHint::EditorView;
32 m_pLinkedViewConfig = nullptr;
33 }
34
35 plViewRenderMode::Enum m_RenderMode;
36 plSceneViewPerspective::Enum m_Perspective;
37 plCameraUsageHint::Enum m_CameraUsageHint;
38 bool m_bUseCameraTransformOnDevice = true;
39
40 plCamera m_Camera;
41 plEngineViewConfig* m_pLinkedViewConfig; // used to store which other view config this is linked to, for resetting values when switching views
42
43 void ApplyPerspectiveSetting(float fFov = 0.0f, float fNearPlane = 0.1f, float fFarPlane = 1000.0f);
44};
45struct PL_EDITORENGINEPROCESSFRAMEWORK_DLL plEngineViewLightSettingsEvent
46{
47 enum class Type
48 {
49 SkyBoxChanged,
50 SkyLightChanged,
51 SkyLightCubeMapChanged,
52 SkyLightIntensityChanged,
53 DirectionalLightChanged,
54 DirectionalLightAngleChanged,
55 DirectionalLightShadowsChanged,
56 DirectionalLightIntensityChanged,
57 FogChanged,
58 DefaultValuesChanged,
59 };
60
61 Type m_Type;
62};
63
64class PL_EDITORENGINEPROCESSFRAMEWORK_DLL plEngineViewLightSettings : public plEditorEngineSyncObject
65{
66 PL_ADD_DYNAMIC_REFLECTION(plEngineViewLightSettings, plEditorEngineSyncObject);
67
68public:
69 plEngineViewLightSettings(bool bEnable = true);
71
72 bool GetSkyBox() const;
73 void SetSkyBox(bool bVal);
74
75 bool GetSkyLight() const;
76 void SetSkyLight(bool bVal);
77
78 const char* GetSkyLightCubeMap() const;
79 void SetSkyLightCubeMap(const char* szVal);
80
81 float GetSkyLightIntensity() const;
82 void SetSkyLightIntensity(float fVal);
83
84 bool GetDirectionalLight() const;
85 void SetDirectionalLight(bool bVal);
86
87 plAngle GetDirectionalLightAngle() const;
88 void SetDirectionalLightAngle(plAngle val);
89
90 bool GetDirectionalLightShadows() const;
91 void SetDirectionalLightShadows(bool bVal);
92
93 float GetDirectionalLightIntensity() const;
94 void SetDirectionalLightIntensity(float fVal);
95
96 bool GetFog() const;
97 void SetFog(bool bVal);
98
99 mutable plEvent<const plEngineViewLightSettingsEvent&> m_EngineViewLightSettingsEvents;
100
101 virtual bool SetupForEngine(plWorld* pWorld, plUInt32 uiNextComponentPickingID) override;
102 virtual void UpdateForEngine(plWorld* pWorld) override;
103
104private:
105 void SetModifiedInternal(plEngineViewLightSettingsEvent::Type type);
106
107 bool m_bSkyBox = false;
108 bool m_bSkyLight = true;
109 plString m_sSkyLightCubeMap = "{ 6449d7e0-a8ff-4b43-9f84-df1c870a4748 }";
110 float m_fSkyLightIntensity = 1.0f;
111
112 bool m_bDirectionalLight = true;
113 plAngle m_DirectionalLightAngle = plAngle::MakeFromDegree(30.0f);
114 bool m_bDirectionalLightShadows = false;
115 float m_fDirectionalLightIntensity = 10.0f;
116
117 bool m_bFog = false;
118
119 // Engine side data
120 plWorld* m_pWorld = nullptr;
121 plGameObjectHandle m_hSkyBoxObject;
122 plComponentHandle m_hSkyBox;
123 plGameObjectHandle m_hGameObject;
124 plComponentHandle m_hDirLight;
125 plComponentHandle m_hSkyLight;
126 plComponentHandle m_hFog;
127};
Float wrapper struct for a safe usage and conversions of angles.
Definition Angle.h:10
static constexpr plAngle MakeFromDegree(float fDegree)
Creates an instance of plAngle that was initialized from degree. (Performs a conversion)
Definition Angle_inl.h:33
A camera class that stores the orientation and some basic camera settings.
Definition Camera.h:41
Definition SyncObject.h:11
Definition ViewRenderSettings.h:65
Definition Event.h:177
A world encapsulates a scene graph of game objects and various component managers and their component...
Definition World.h:22
Enum
Definition Declarations.h:85
@ EditorView
The editor view shall be rendered from this camera.
Definition Declarations.h:88
A handle to a component.
Definition Declarations.h:138
Definition ViewRenderSettings.h:26
Definition ViewRenderSettings.h:46
A handle to a game object.
Definition Declarations.h:76
Definition ViewRenderSettings.h:10