|
|
|
|
@ -34,8 +34,16 @@ namespace AZ
|
|
|
|
|
&AzFramework::WindowRequestBus::Events::GetClientAreaSize);
|
|
|
|
|
AzFramework::WindowNotificationBus::Handler::BusConnect(nativeWindow);
|
|
|
|
|
|
|
|
|
|
SetRenderScene(renderScene);
|
|
|
|
|
}
|
|
|
|
|
m_onProjectionMatrixChangedHandler = ViewportContext::MatrixChangedEvent::Handler([this](const AZ::Matrix4x4& matrix)
|
|
|
|
|
{
|
|
|
|
|
m_projectionMatrixChangedEvent.Signal(matrix);
|
|
|
|
|
});
|
|
|
|
|
m_onViewMatrixChangedHandler = ViewportContext::MatrixChangedEvent::Handler([this](const AZ::Matrix4x4& matrix)
|
|
|
|
|
{
|
|
|
|
|
m_projectionMatrixChangedEvent.Signal(matrix);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
SetRenderScene(renderScene); }
|
|
|
|
|
|
|
|
|
|
ViewportContext::~ViewportContext()
|
|
|
|
|
{
|
|
|
|
|
@ -175,7 +183,6 @@ namespace AZ
|
|
|
|
|
void ViewportContext::SetCameraProjectionMatrix(const AZ::Matrix4x4& matrix)
|
|
|
|
|
{
|
|
|
|
|
GetDefaultView()->SetViewToClipMatrix(matrix);
|
|
|
|
|
m_projectionMatrixChangedEvent.Signal(matrix);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AZ::Transform ViewportContext::GetCameraTransform() const
|
|
|
|
|
@ -192,18 +199,23 @@ namespace AZ
|
|
|
|
|
{
|
|
|
|
|
const auto view = GetDefaultView();
|
|
|
|
|
view->SetCameraTransform(AZ::Matrix3x4::CreateFromTransform(transform.GetOrthogonalized()));
|
|
|
|
|
m_viewMatrixChangedEvent.Signal(view->GetWorldToViewMatrix());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ViewportContext::SetDefaultView(ViewPtr view)
|
|
|
|
|
{
|
|
|
|
|
if (m_defaultView != view)
|
|
|
|
|
{
|
|
|
|
|
m_onProjectionMatrixChangedHandler.Disconnect();
|
|
|
|
|
m_onViewMatrixChangedHandler.Disconnect();
|
|
|
|
|
|
|
|
|
|
m_defaultView = view;
|
|
|
|
|
UpdatePipelineView();
|
|
|
|
|
|
|
|
|
|
m_viewMatrixChangedEvent.Signal(view->GetWorldToViewMatrix());
|
|
|
|
|
m_projectionMatrixChangedEvent.Signal(view->GetViewToClipMatrix());
|
|
|
|
|
|
|
|
|
|
view->ConnectWorldToViewMatrixChangedHandler(m_onViewMatrixChangedHandler);
|
|
|
|
|
view->ConnectWorldToClipMatrixChangedHandler(m_onProjectionMatrixChangedHandler);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|