Merge remote-tracking branch 'upstream/development' into Atom/santorac/RemixableMaterialTypes

This commit is contained in:
santorac
2021-09-28 22:12:18 -07:00
849 changed files with 24505 additions and 12168 deletions
@@ -116,11 +116,18 @@ namespace AtomToolsFramework
// ModularViewportCameraControllerRequestBus overrides ...
void InterpolateToTransform(const AZ::Transform& worldFromLocal, float lookAtDistance) override;
AZStd::optional<AZ::Vector3> LookAtAfterInterpolation() const override;
AZ::Transform GetReferenceFrame() const override;
void SetReferenceFrame(const AZ::Transform& worldFromLocal) override;
void ClearReferenceFrame() override;
private:
// AzFramework::ViewportDebugDisplayEventBus overrides ...
void DisplayViewport(const AzFramework::ViewportInfo& viewportInfo, AzFramework::DebugDisplayRequests& debugDisplay) override;
//! Update the reference frame after a change has been made to the camera
//! view without updating the internal camera via user input.
void RefreshReferenceFrame();
//! The current mode the camera controller is in.
enum class CameraMode
{
@@ -139,6 +146,8 @@ 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.
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.
@@ -147,6 +156,7 @@ namespace AtomToolsFramework
CameraMode m_cameraMode = CameraMode::Control; //!< The current mode the camera is operating in.
AZStd::optional<AZ::Vector3> m_lookAtAfterInterpolation; //!< The look at point after an interpolation has finished.
//!< Will be cleared when the view changes (camera looks away).
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;
//! Listen for camera view changes outside of the camera controller.
@@ -154,4 +164,17 @@ namespace AtomToolsFramework
//! The current instance of the modular camera viewport context.
AZStd::unique_ptr<ModularCameraViewportContext> m_modularCameraViewportContext;
};
//! Placeholder implementation for ModularCameraViewportContext (useful for verifying the interface).
class PlaceholderModularCameraViewportContextImpl : public AtomToolsFramework::ModularCameraViewportContext
{
public:
AZ::Transform GetCameraTransform() const override;
void SetCameraTransform(const AZ::Transform& transform) override;
void ConnectViewMatrixChangedHandler(AZ::RPI::ViewportContext::MatrixChangedEvent::Handler& handler) override;
private:
AZ::Transform m_cameraTransform = AZ::Transform::CreateIdentity();
AZ::RPI::ViewportContext::MatrixChangedEvent m_viewMatrixChangedEvent;
};
} // namespace AtomToolsFramework
@@ -35,6 +35,16 @@ namespace AtomToolsFramework
//! Look at point after an interpolation has finished and no translation has occurred.
virtual AZStd::optional<AZ::Vector3> LookAtAfterInterpolation() const = 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;
//! Set a new reference frame other than the identity for the camera controller.
virtual void SetReferenceFrame(const AZ::Transform& worldFromLocal) = 0;
//! Clear the current reference frame to restore the identity.
virtual void ClearReferenceFrame() = 0;
protected:
~ModularViewportCameraControllerRequests() = default;
};
@@ -159,8 +159,6 @@ namespace AtomToolsFramework
AZ::RPI::ViewPtr m_defaultCamera;
// Our viewport-local aux geom pipeline for supplemental rendering.
AZ::RPI::AuxGeomDrawPtr m_auxGeom;
// Used to keep track of a pending resize event to avoid initialization before window activate.
bool m_windowResizedEvent = false;
// Tracks whether the cursor is currently over our viewport, used for mouse input event book-keeping.
bool m_mouseOver = false;
// The last recorded mouse position, in local viewport screen coordinates.