Add an Orthogonal Projection option to the Camera Gem (#2414)

* Add an Orthogonal Projection option to the Camera Gem

This adds a check-box to opt into an ortho projection along with a half-width parameter to adjust the size of the visible area. Includes some light tweaks to ensure debug rendering looks OK and that we generate a correct camera state for these non-perspective views.

Known issue: while in "Be this camera" mode in the Editor using an ortho projection manipulators aren't working correctly. This appears to be a downstream issue with CameraState consumers not actually checking the ortho flag.

Signed-off-by: nvsickle <nvsickle@amazon.com>

* Fix some typos

Signed-off-by: nvsickle <nvsickle@amazon.com>

* Account for reversed depth buffer

Signed-off-by: nvsickle <nvsickle@amazon.com>

* Clarify depth reversal for MakeOrthographicMatrixRH

Signed-off-by: nvsickle <nvsickle@amazon.com>
This commit is contained in:
Nicholas Van Sickle
2021-07-26 13:58:50 -07:00
committed by GitHub
parent e81f59d1e1
commit 7f84a4318c
12 changed files with 232 additions and 33 deletions
@@ -103,9 +103,15 @@ namespace Camera
->Event("SetNearClipDistance", &CameraRequestBus::Events::SetNearClipDistance)
->Event("SetFarClipDistance", &CameraRequestBus::Events::SetFarClipDistance)
->Event("MakeActiveView", &CameraRequestBus::Events::MakeActiveView)
->Event("IsOrthographic", &CameraRequestBus::Events::IsOrthographic)
->Event("SetOrthographic", &CameraRequestBus::Events::SetOrthographic)
->Event("GetOrthographicHalfWidth", &CameraRequestBus::Events::GetOrthographicHalfWidth)
->Event("SetOrthographicHalfWidth", &CameraRequestBus::Events::SetOrthographicHalfWidth)
->VirtualProperty("FieldOfView","GetFovDegrees","SetFovDegrees")
->VirtualProperty("NearClipDistance", "GetNearClipDistance", "SetNearClipDistance")
->VirtualProperty("FarClipDistance", "GetFarClipDistance", "SetFarClipDistance")
->VirtualProperty("Orthographic", "IsOrthographic", "SetOrthographic")
->VirtualProperty("OrthographicHalfWidth", "GetOrthographicHalfWidth", "SetOrthographicHalfWidth")
;
behaviorContext->Class<CameraComponent>()->RequestBus("CameraRequestBus");