Camera Component, Editor Viewport Widget refactoring.

Merge pull request #2840 from yuriy0/camera_and_editor_viewport_widget_improvements
This commit is contained in:
hultonha
2021-08-09 14:01:41 +01:00
committed by GitHub
55 changed files with 860 additions and 6259 deletions
@@ -44,6 +44,22 @@ namespace AZ
return &out;
}
void SetPerspectiveMatrixFOV(Matrix4x4& out, float fovY, float aspectRatio)
{
float sinFov, cosFov;
SinCos(0.5f * fovY, sinFov, cosFov);
float yScale = cosFov / sinFov; //cot(fovY/2)
float xScale = yScale / aspectRatio;
out.SetElement(0, 0, xScale);
out.SetElement(1, 1, yScale);
}
float GetPerspectiveMatrixFOV(const Matrix4x4& m)
{
return 2.0 * AZStd::atan(1.0f / m.GetElement(1, 1));
}
Matrix4x4* MakeFrustumMatrixRH(Matrix4x4& out, float left, float right, float bottom, float top, float nearDist, float farDist, bool reverseDepth)
{
AZ_Assert(right > left, "right should be greater than left");
@@ -64,4 +64,8 @@ namespace AZ
//! Transforms a position by a matrix. This function can be used with any generic cases which include projection matrices.
Vector3 MatrixTransformPosition(const Matrix4x4& matrix, const Vector3& inPosition);
void SetPerspectiveMatrixFOV(Matrix4x4& out, float fovY, float aspectRatio);
float GetPerspectiveMatrixFOV(const Matrix4x4& m);
} // namespace AZ
@@ -114,6 +114,9 @@ namespace Camera
//! Makes the camera the active view
virtual void MakeActiveView() = 0;
//! Check if this camera is the active render camera
virtual bool IsActiveView() = 0;
//! Get the camera frustum's aggregate configuration
virtual Configuration GetCameraConfiguration()
{