Camera Component, Editor Viewport Widget refactoring.

- Handle changing of active camera entirely inside CameraComponentController
- Remove a LOT of legacy Cry things related to cameras
- Add a CameraSystemComponent to handle ActiveCameraRequestBus and CameraSystemRequestBus

Signed-off-by: Yuriy Toporovskyy <toporovskyy.y@gmail.com>
This commit is contained in:
Yuriy Toporovskyy
2021-08-04 10:39:57 -04:00
parent 6d2765ef42
commit 73fee0c57e
47 changed files with 1126 additions and 6046 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 * 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()
{