You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
85 lines
3.4 KiB
C++
85 lines
3.4 KiB
C++
/*
|
|
* 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 <AzToolsFramework/Manipulators/ManipulatorView.h>
|
|
|
|
#include <WhiteBox/WhiteBoxToolApi.h>
|
|
|
|
namespace AzFramework
|
|
{
|
|
class DebugDisplayRequests;
|
|
}
|
|
|
|
namespace WhiteBox
|
|
{
|
|
//! Displays a polygon with an outline around the edge.
|
|
class ManipulatorViewPolygon : public AzToolsFramework::ManipulatorView
|
|
{
|
|
public:
|
|
AZ_CLASS_ALLOCATOR_DECL
|
|
|
|
AZ_RTTI(ManipulatorViewPolygon, "{B2290233-1D42-4AF5-8949-7CF9601832E2}", AzToolsFramework::ManipulatorView)
|
|
|
|
ManipulatorViewPolygon();
|
|
|
|
void Draw(
|
|
AzToolsFramework::ManipulatorManagerId managerId,
|
|
const AzToolsFramework::ManipulatorManagerState& managerState,
|
|
AzToolsFramework::ManipulatorId manipulatorId, const AzToolsFramework::ManipulatorState& manipulatorState,
|
|
AzFramework::DebugDisplayRequests& debugDisplay, const AzFramework::CameraState& cameraState,
|
|
const AzToolsFramework::ViewportInteraction::MouseInteraction& mouseInteraction) override;
|
|
|
|
AZStd::vector<AZ::Vector3> m_triangles;
|
|
Api::VertexPositionsCollection m_outlines;
|
|
|
|
AZ::Color m_outlineColor = AZ::Color(1.0f, 1.0f, 0.0f, 1.0f); //!< Yellow
|
|
AZ::Color m_fillColor = AZ::Color(1.0f, 1.0f, 0.0f, 0.5f); //!< Yellow
|
|
};
|
|
|
|
class ManipulatorViewEdge : public AzToolsFramework::ManipulatorView
|
|
{
|
|
public:
|
|
AZ_CLASS_ALLOCATOR_DECL
|
|
|
|
AZ_RTTI(ManipulatorViewEdge, "{42F07925-5B2F-4CC6-9033-CF2FE548BF8A}", AzToolsFramework::ManipulatorView)
|
|
|
|
ManipulatorViewEdge();
|
|
|
|
void Draw(
|
|
AzToolsFramework::ManipulatorManagerId managerId,
|
|
const AzToolsFramework::ManipulatorManagerState& managerState,
|
|
AzToolsFramework::ManipulatorId manipulatorId, const AzToolsFramework::ManipulatorState& manipulatorState,
|
|
AzFramework::DebugDisplayRequests& debugDisplay, const AzFramework::CameraState& cameraState,
|
|
const AzToolsFramework::ViewportInteraction::MouseInteraction& mouseInteraction) override;
|
|
|
|
void SetColor(const AZ::Color& color, const AZ::Color& hoverColor);
|
|
void SetWidth(float width, float hoverWidth);
|
|
|
|
AZ::Vector3 m_start;
|
|
AZ::Vector3 m_end;
|
|
AZStd::array<float, 2> m_width;
|
|
AZStd::array<AZ::Color, 2> m_color;
|
|
AZStd::array<bool, 2> m_vertexStartEndHidden; //!< When this manipulator view was created, were the adjoining
|
|
//!< vertex handles hidden or not.
|
|
};
|
|
|
|
void TranslatePoints(AZStd::vector<AZ::Vector3>& points, const AZ::Vector3& offset);
|
|
|
|
AZStd::unique_ptr<ManipulatorViewPolygon> CreateManipulatorViewPolygon(
|
|
const AZStd::vector<AZ::Vector3>& triangles, const Api::VertexPositionsCollection& outlines);
|
|
|
|
AZStd::unique_ptr<ManipulatorViewEdge> CreateManipulatorViewEdge(const AZ::Vector3& start, const AZ::Vector3& end);
|
|
|
|
} // namespace WhiteBox
|