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
@@ -104,6 +104,9 @@ namespace AZ
m_worldToClipMatrix = m_viewToClipMatrix * m_worldToViewMatrix;
m_worldToClipMatrixChanged = true;
m_onWorldToViewMatrixChange.Signal(m_worldToViewMatrix);
m_oWworldToClipMatrixChange.Signal(m_worldToClipMatrix);
InvalidateSrg();
}
@@ -132,6 +135,9 @@ namespace AZ
m_clipToWorldMatrix = m_viewToWorldMatrix * m_clipToViewMatrix;
m_worldToClipMatrixChanged = true;
m_onWorldToViewMatrixChange.Signal(m_worldToViewMatrix);
m_oWworldToClipMatrixChange.Signal(m_worldToClipMatrix);
InvalidateSrg();
}
@@ -166,6 +172,8 @@ namespace AZ
m_unprojectionConstants.SetZ(float(-tanHalfFovX));
m_unprojectionConstants.SetW(float(tanHalfFovY));
m_oWworldToClipMatrixChange.Signal(m_worldToClipMatrix);
InvalidateSrg();
}
@@ -225,6 +233,16 @@ namespace AZ
passWithDrawListTag->SortDrawList(drawList);
}
void View::ConnectWorldToViewMatrixChangedHandler(View::MatrixChangedEvent::Handler& handler)
{
handler.Connect(m_onWorldToViewMatrixChange);
}
void View::ConnectWorldToClipMatrixChangedHandler(View::MatrixChangedEvent::Handler& handler)
{
handler.Connect(m_oWworldToClipMatrixChange);
}
// [GFX TODO] This function needs unit tests and might need to be reworked
RHI::DrawItemSortKey View::GetSortKeyForPosition(const Vector3& positionInWorld) const
{