Merge commit 'a6164ca2cd3f573fd7735c3825568b1e25b12c2b' into puvvadar/gitflow_211118_o3de

This commit is contained in:
puvvadar
2021-11-18 09:36:53 -08:00
8 changed files with 131 additions and 118 deletions
@@ -113,14 +113,14 @@ namespace AtomToolsFramework
// ModularViewportCameraControllerRequestBus overrides ...
void InterpolateToTransform(const AZ::Transform& worldFromLocal) override;
AZ::Transform GetReferenceFrame() const override;
void SetReferenceFrame(const AZ::Transform& worldFromLocal) override;
void ClearReferenceFrame() override;
void StartTrackingTransform(const AZ::Transform& worldFromLocal) override;
void StopTrackingTransform() override;
bool IsTrackingTransform() const override;
private:
//! Update the reference frame after a change has been made to the camera
//! view without updating the internal camera via user input.
void RefreshReferenceFrame();
//! Combine the current camera transform with any potential roll from the tracked
//! transform (this is usually zero).
AZ::Transform CombinedCameraTransform() const;
//! The current mode the camera controller is in.
enum class CameraMode
@@ -141,21 +141,21 @@ namespace AtomToolsFramework
AzFramework::Camera m_camera; //!< The current camera state (pitch/yaw/position/look-distance).
AzFramework::Camera m_targetCamera; //!< The target (next) camera state that m_camera is catching up to.
AzFramework::Camera m_previousCamera; //!< The state of the camera from the previous frame.
AZStd::optional<AzFramework::Camera> m_storedCamera; //!< A potentially stored camera for when a custom reference frame is set.
AZStd::optional<AzFramework::Camera> m_storedCamera; //!< A potentially stored camera for when a transform is being tracked.
AzFramework::CameraSystem m_cameraSystem; //!< The camera system responsible for managing all CameraInputs.
AzFramework::CameraProps m_cameraProps; //!< Camera properties to control rotate and translate smoothness.
CameraControllerPriorityFn m_priorityFn; //!< Controls at what priority the camera controller should respond to events.
CameraAnimation m_cameraAnimation; //!< Camera animation state (used during CameraMode::Animation).
CameraMode m_cameraMode = CameraMode::Control; //!< The current mode the camera is operating in.
//! An additional reference frame the camera can operate in (identity has no effect).
AZ::Transform m_referenceFrameOverride = AZ::Transform::CreateIdentity();
//! Flag to prevent circular updates of the camera transform (while the viewport transform is being updated internally).
bool m_updatingTransformInternally = false;
float m_roll = 0.0f; //!< The current amount of roll to be applied to the camera.
float m_targetRoll = 0.0f; //!< The target amount of roll to be applied to the camera (current will move towards this).
//! Listen for camera view changes outside of the camera controller.
AZ::RPI::ViewportContext::MatrixChangedEvent::Handler m_cameraViewMatrixChangeHandler;
//! The current instance of the modular camera viewport context.
AZStd::unique_ptr<ModularCameraViewportContext> m_modularCameraViewportContext;
//! Flag to prevent circular updates of the camera transform (while the viewport transform is being updated internally).
bool m_updatingTransformInternally = false;
};
//! Placeholder implementation for ModularCameraViewportContext (useful for verifying the interface).
@@ -31,15 +31,16 @@ namespace AtomToolsFramework
//! @param worldFromLocal The transform of where the camera should end up.
virtual void InterpolateToTransform(const AZ::Transform& worldFromLocal) = 0;
//! Return the current reference frame.
//! @note If a reference frame has not been set or a frame has been cleared, this is just the identity.
virtual AZ::Transform GetReferenceFrame() const = 0;
//! Start tracking a transform.
//! Store the current camera transform and move to the next camera transform.
virtual void StartTrackingTransform(const AZ::Transform& worldFromLocal) = 0;
//! Set a new reference frame other than the identity for the camera controller.
virtual void SetReferenceFrame(const AZ::Transform& worldFromLocal) = 0;
//! Stop tracking the set transform.
//! The previously stored camera transform is restored.
virtual void StopTrackingTransform() = 0;
//! Clear the current reference frame to restore the identity.
virtual void ClearReferenceFrame() = 0;
//! Return if the tracking transform is set.
virtual bool IsTrackingTransform() const = 0;
protected:
~ModularViewportCameraControllerRequests() = default;