Fix game mode camera components not working in-Editor

Ensures RPI::View updates always make it back to the ViewportContext, even if you talk directly to the View
This commit is contained in:
nvsickle
2021-04-22 17:35:27 -07:00
parent e1ae61ca06
commit 9e6244dc99
4 changed files with 45 additions and 4 deletions
@@ -118,6 +118,12 @@ namespace AZ
//! Update View's SRG values and compile. This should only be called once per frame before execute command lists.
void UpdateSrg();
using MatrixChangedEvent = AZ::Event<const AZ::Matrix4x4&>;
//! Notifies consumers when the world to view matrix has changed.
void ConnectWorldToViewMatrixChangedHandler(MatrixChangedEvent::Handler& handler);
//! Notifies consumers when the world to clip matrix has changed.
void ConnectWorldToClipMatrixChangedHandler(MatrixChangedEvent::Handler& handler);
private:
View() = delete;
View(const AZ::Name& name, UsageFlags usage);
@@ -182,6 +188,9 @@ namespace AZ
// view class doesn't contain subroutines called at the end of each frame
bool m_worldToClipMatrixChanged = true;
bool m_worldToClipPrevMatrixNeedsUpdate = false;
MatrixChangedEvent m_oWworldToClipMatrixChange;
MatrixChangedEvent m_onWorldToViewMatrixChange;
};
AZ_DEFINE_ENUM_BITWISE_OPERATORS(View::UsageFlags);
@@ -125,7 +125,9 @@ namespace AZ
AzFramework::WindowSize m_viewportSize;
SizeChangedEvent m_sizeChangedEvent;
MatrixChangedEvent m_viewMatrixChangedEvent;
MatrixChangedEvent::Handler m_onViewMatrixChangedHandler;
MatrixChangedEvent m_projectionMatrixChangedEvent;
MatrixChangedEvent::Handler m_onProjectionMatrixChangedHandler;
SceneChangedEvent m_sceneChangedEvent;
ViewportContextManager* m_manager;
RenderPipelinePtr m_currentPipeline;