ezEngine  Milestone 7
View.h
1 #pragma once
2 
3 #include <Foundation/Profiling/Profiling.h>
4 #include <Foundation/Strings/HashedString.h>
5 #include <Foundation/Threading/DelegateTask.h>
6 #include <RendererCore/Pipeline/RenderPipeline.h>
7 
8 class ezWorld;
9 
11 class EZ_RENDERERCORE_DLL ezView : public ezNode
12 {
14 
15 private:
17  ezView();
18  ~ezView();
19 
20 public:
21  void SetName(const char* szName);
22  const char* GetName() const;
23 
24  void SetWorld(ezWorld* pWorld);
25  ezWorld* GetWorld();
26  const ezWorld* GetWorld() const;
27 
28  void SetRenderPipeline(ezUniquePtr<ezRenderPipeline>&& pRenderPipeline);
29  ezRenderPipeline* GetRenderPipeline() const;
30 
31  void SetLogicCamera(const ezCamera* pCamera);
32  const ezCamera* GetLogicCamera() const;
33 
34  void SetRenderCamera(const ezCamera* pCamera);
35  const ezCamera* GetRenderCamera() const;
36 
37  void SetViewport(const ezRectFloat& viewport);
38  const ezRectFloat& GetViewport() const;
39 
40  const ezViewData& GetData() const;
41 
42  bool IsValid() const;
43 
44 
46  void ExtractData();
47 
49  ezTask* GetExtractTask();
50 
51 
56  ezResult ComputePickingRay(float fScreenPosX, float fScreenPosY, ezVec3& out_RayStartPos, ezVec3& out_RayDir);
57 
59  const ezMat4& GetProjectionMatrix() const;
60 
62  const ezMat4& GetInverseProjectionMatrix() const;
63 
65  const ezMat4& GetViewMatrix() const;
66 
68  const ezMat4& GetInverseViewMatrix() const;
69 
71  const ezMat4& GetViewProjectionMatrix() const;
72 
74  const ezMat4& GetInverseViewProjectionMatrix() const;
75 
76  ezTagSet m_IncludeTags;
77  ezTagSet m_ExcludeTags;
78 
79 private:
80  friend class ezRenderLoop;
81 
82  ezHashedString m_sName;
83 
84  ezProfilingId m_ExtractDataProfilingID;
85 
86  ezDelegateTask<void> m_ExtractTask;
87 
88  ezWorld* m_pWorld;
89  ezUniquePtr<ezRenderPipeline> m_pRenderPipeline;
90  const ezCamera* m_pLogicCamera;
91  const ezCamera* m_pRenderCamera;
92 
93 private:
94  ezInputNodePin m_PinRenderTarget0;
95  ezInputNodePin m_PinRenderTarget1;
96  ezInputNodePin m_PinRenderTarget2;
97  ezInputNodePin m_PinRenderTarget3;
98  ezInputNodePin m_PinDepthStencil;
99 
100 private:
101  void UpdateCachedMatrices() const;
102 
103  mutable ezUInt32 m_uiLastCameraSettingsModification;
104  mutable ezUInt32 m_uiLastCameraOrientationModification;
105  mutable float m_fLastViewportAspectRatio;
106 
107  mutable ezViewData m_Data;
108 };
109 
110 #include <RendererCore/Pipeline/Implementation/View_inl.h>