Integrating latest 47acbe8

This commit is contained in:
alexpete
2021-03-25 13:57:57 -07:00
parent 448c549698
commit 75dc720198
10312 changed files with 2711566 additions and 671451 deletions
+33 -12
View File
@@ -1402,7 +1402,7 @@ void CRenderViewport::Update()
AZ_Printf("Visibility", "FindVisibleEntities (new) - Duration: %f", diff);
}
}
{
SScopedCurrentContext context(this);
@@ -1470,11 +1470,6 @@ void CRenderViewport::SetViewEntity(const AZ::EntityId& viewEntityId, bool lockC
//////////////////////////////////////////////////////////////////////////
void CRenderViewport::ResetToViewSourceType(const ViewSourceType& viewSourceType)
{
if (m_pCameraFOVVariable)
{
m_pCameraFOVVariable->RemoveOnSetCallback(
functor(*this, &CRenderViewport::OnCameraFOVVariableChanged));
}
LockCameraMovement(true);
m_pCameraFOVVariable = nullptr;
m_viewEntityId.SetInvalid();
@@ -2270,26 +2265,30 @@ void CRenderViewport::OnMenuSelectCurrentCamera()
}
}
AzFramework::CameraState CRenderViewport::GetCameraState()
static AzFramework::CameraState CameraStateFromCCamera(
const CCamera& camera, const float fov, const float width, const float height)
{
FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR);
AzFramework::CameraState state;
const CCamera& camera = GetCamera();
state.m_forward = LYVec3ToAZVec3(camera.GetViewdir());
state.m_up = LYVec3ToAZVec3(camera.GetUp());
state.m_side = state.m_forward.Cross(state.m_up);
state.m_position = LYVec3ToAZVec3(camera.GetPosition());
state.m_fovOrZoom = GetFOV();
state.m_fovOrZoom = fov;
state.m_nearClip = camera.GetNearPlane();
state.m_farClip = camera.GetFarPlane();
state.m_orthographic = false;
state.m_viewportSize = AZ::Vector2(m_rcClient.width(), m_rcClient.height());
state.m_viewportSize = AZ::Vector2(width, height);
return state;
}
AzFramework::CameraState CRenderViewport::GetCameraState()
{
return CameraStateFromCCamera(GetCamera(), GetFOV(), m_rcClient.width(), m_rcClient.height());
}
bool CRenderViewport::GridSnappingEnabled()
{
return GetViewManager()->GetGrid()->IsEnabled();
@@ -3508,7 +3507,7 @@ Vec3 CRenderViewport::ViewToWorld(const QPoint& vp, bool* collideWithTerrain, bo
AZ_UNUSED(bSkipVegetation)
AZ_UNUSED(bSkipVegetation)
AZStd::optional<AZStd::pair<float, AZ::Vector3>> hitDistancePosition;
if (!onlyTerrain && !GetIEditor()->IsTerrainAxisIgnoreObjects())
{
AzFramework::EntityContextId editorContextId;
@@ -4197,6 +4196,28 @@ bool CRenderViewport::GetActiveCameraPosition(AZ::Vector3& cameraPos)
return false;
}
bool CRenderViewport::GetActiveCameraState(AzFramework::CameraState& cameraState)
{
if (m_pPrimaryViewport == this)
{
if (GetIEditor()->IsInGameMode())
{
const auto& renderingCamera = m_engine->GetRenderingCamera();
cameraState = CameraStateFromCCamera(
renderingCamera, renderingCamera.GetFov(), m_rcClient.width(), m_rcClient.height());
}
else
{
const auto& camera = GetCamera();
cameraState = CameraStateFromCCamera(camera, GetFOV(), m_rcClient.width(), m_rcClient.height());
}
return true;
}
return false;
}
void CRenderViewport::OnStartPlayInEditor()
{
if (m_viewEntityId.IsValid())