Plasma Engine  2.0
Loading...
Searching...
No Matches
EngineProcessViewContext.h
1#pragma once
2
3#include <Core/Graphics/Camera.h>
4#include <Core/ResourceManager/ResourceHandle.h>
5#include <Core/System/Window.h>
6#include <EditorEngineProcessFramework/EditorEngineProcessFrameworkDLL.h>
7#include <RendererCore/Pipeline/Declarations.h>
8
14class plActor;
16
18
20class PL_EDITORENGINEPROCESSFRAMEWORK_DLL plEditorProcessViewWindow : public plWindowBase
21{
22public:
24 {
25 m_hWnd = INVALID_WINDOW_HANDLE_VALUE;
26 m_uiWidth = 0;
27 m_uiHeight = 0;
28 }
29
31
32 plResult UpdateWindow(plWindowHandle hParentWindow, plUInt16 uiWidth, plUInt16 uiHeight);
33
34 // Inherited via plWindowBase
35 virtual plSizeU32 GetClientAreaSize() const override { return plSizeU32(m_uiWidth, m_uiHeight); }
36 virtual plWindowHandle GetNativeWindowHandle() const override { return m_hWnd; }
37 virtual void ProcessWindowMessages() override {}
38 virtual bool IsFullscreenWindow(bool bOnlyProperFullscreenMode = false) const override { return false; }
39 virtual bool IsVisible() const override { return true; }
40 virtual void AddReference() override { m_iReferenceCount.Increment(); }
41 virtual void RemoveReference() override { m_iReferenceCount.Decrement(); }
42
43
44 plUInt16 m_uiWidth;
45 plUInt16 m_uiHeight;
46
47private:
48 plWindowHandle m_hWnd;
49 plAtomicInteger32 m_iReferenceCount = 0;
50};
51
53class PL_EDITORENGINEPROCESSFRAMEWORK_DLL plEngineProcessViewContext
54{
55public:
58
59 void SetViewID(plUInt32 uiId);
60
61 plEngineProcessDocumentContext* GetDocumentContext() const { return m_pDocumentContext; }
62
63 virtual void HandleViewMessage(const plEditorEngineViewMsg* pMsg);
64 virtual void SetupRenderTarget(plGALSwapChainHandle hSwapChain, const plGALRenderTargets* pRenderTargets, plUInt16 uiWidth, plUInt16 uiHeight);
65 virtual void Redraw(bool bRenderEditorGizmos);
66
68 static bool FocusCameraOnObject(plCamera& inout_camera, const plBoundingBoxSphere& objectBounds, float fFov, const plVec3& vViewDir);
69
70 plViewHandle GetViewHandle() const { return m_hView; }
71
72 void DrawSimpleGrid() const;
73
74protected:
75 void SendViewMessage(plEditorEngineViewMsg* pViewMsg);
76 void HandleWindowUpdate(plWindowHandle hWnd, plUInt16 uiWidth, plUInt16 uiHeight);
77 void OnSwapChainChanged(plGALSwapChainHandle hSwapChain, plSizeU32 size);
78
79 virtual void SetCamera(const plViewRedrawMsgToEngine* pMsg);
80
82 virtual plRenderPipelineResourceHandle CreateDefaultRenderPipeline();
83
85 virtual plRenderPipelineResourceHandle CreateDebugRenderPipeline();
86
88 virtual plViewHandle CreateView() = 0;
89
90private:
91 plEngineProcessDocumentContext* m_pDocumentContext;
92 plActor* m_pEditorWndActor = nullptr;
93
94protected:
95 plCamera m_Camera;
96 plViewHandle m_hView;
97 plUInt32 m_uiViewID;
98};
Definition Actor.h:9
A camera class that stores the orientation and some basic camera settings.
Definition Camera.h:41
Base class for all messages that are tied to some document.
Definition EngineProcessMessages.h:151
Definition EngineProcessMessages.h:196
Represents the window inside the editor process, into which the engine process renders.
Definition EngineProcessViewContext.h:21
virtual bool IsVisible() const override
Whether the window can potentially be seen by the user. Windows that are minimized or hidden are not ...
Definition EngineProcessViewContext.h:39
virtual bool IsFullscreenWindow(bool bOnlyProperFullscreenMode=false) const override
Whether the window is a fullscreen window or should be one - some platforms may enforce this via the ...
Definition EngineProcessViewContext.h:38
A document context is the counter part to an editor document on the engine side.
Definition EngineProcessDocumentContext.h:42
Represents the view/window on the engine process side, holds all data necessary for rendering.
Definition EngineProcessViewContext.h:54
virtual plViewHandle CreateView()=0
Create the actual view.
Definition RenderTargetSetup.h:19
Definition RendererFoundationDLL.h:397
Definition Declarations.h:64
Definition EngineProcessMessages.h:257
Base class of all window classes that have a client area and a native window handle.
Definition Window.h:134
Definition RenderTargetSetup.h:9
Default enum for returning failure or success, instead of using a bool.
Definition Types.h:54