/* * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or * its licensors. * * For complete copyright and license terms please see the LICENSE at the root of this * distribution (the "License"). All use of this software is governed by the License, * or, if provided, by the license below or the license accompanying this file. Do not * remove or modify any license notices. This file is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * */ #pragma once #include "Viewport/WhiteBoxManipulatorBounds.h" #include "Viewport/WhiteBoxViewportConstants.h" #include #include #include namespace AzToolsFramework { class LinearManipulator; } namespace WhiteBox { class ManipulatorViewPolygon; //! Provides manipulators for translating a polygon on a white box mesh. class PolygonTranslationModifier { public: AZ_CLASS_ALLOCATOR_DECL PolygonTranslationModifier( const AZ::EntityComponentIdPair& entityComponentIdPair, const Api::PolygonHandle& polygonHandle, const AZ::Vector3& intersectionPoint); ~PolygonTranslationModifier(); bool MouseOver() const; void ForwardMouseOverEvent(const AzToolsFramework::ViewportInteraction::MouseInteraction& interaction); Api::PolygonHandle GetHandle() const; // Generic context version Api::PolygonHandle GetPolygonHandle() const; void SetPolygonHandle(const Api::PolygonHandle& polygonHandle); void SetColors(const AZ::Color& fillColor, const AZ::Color& outlineColor); void Refresh(); void CreateView(); bool PerformingAction() const; private: void CreateManipulator(); void DestroyManipulator(); AZ::EntityComponentIdPair m_entityComponentIdPair; //!< The entity and component id this modifier is associated with. AZStd::shared_ptr m_translationManipulator; //!< The manipulator used to modify the position of the polygon (triangles). AZStd::vector m_vertexHandles; //!< The vertex handles associated with this polygon. Api::PolygonHandle m_polygonHandle; //!< The polygon handle this modifier is associated with. AZStd::shared_ptr m_polygonView; //!< Manipulator view used to represent a mesh polygon for translation. AZ::Color m_fillColor = cl_whiteBoxPolygonHoveredColor; //!< The color to use for the highlighted filled section of the polygon. AZ::Color m_outlineColor = cl_whiteBoxPolygonHoveredOutlineColor; //!< The color to use for the outline of the polygon. }; inline Api::PolygonHandle PolygonTranslationModifier::GetHandle() const { return GetPolygonHandle(); } inline Api::PolygonHandle PolygonTranslationModifier::GetPolygonHandle() const { return m_polygonHandle; } inline void PolygonTranslationModifier::SetColors(const AZ::Color& fillColor, const AZ::Color& outlineColor) { m_fillColor = fillColor; m_outlineColor = outlineColor; } } // namespace WhiteBox