62 lines
1.7 KiB
C++
62 lines
1.7 KiB
C++
#pragma once
|
|
|
|
#include <XCEngine/UI/DrawData.h>
|
|
#include <XCEngine/UI/Types.h>
|
|
|
|
#include <memory>
|
|
#include <vector>
|
|
|
|
namespace XCEngine::UI::Editor::App {
|
|
|
|
class EditorSceneRuntime;
|
|
|
|
struct LegacySceneViewportTriangle {
|
|
::XCEngine::UI::UIPoint a = {};
|
|
::XCEngine::UI::UIPoint b = {};
|
|
::XCEngine::UI::UIPoint c = {};
|
|
::XCEngine::UI::UIColor color = {};
|
|
};
|
|
|
|
struct LegacySceneViewportGizmoFrame {
|
|
bool visible = false;
|
|
::XCEngine::UI::UIRect clipRect = {};
|
|
std::vector<LegacySceneViewportTriangle> triangles = {};
|
|
};
|
|
|
|
class LegacySceneViewportGizmo {
|
|
public:
|
|
LegacySceneViewportGizmo();
|
|
~LegacySceneViewportGizmo();
|
|
|
|
LegacySceneViewportGizmo(const LegacySceneViewportGizmo&) = delete;
|
|
LegacySceneViewportGizmo& operator=(const LegacySceneViewportGizmo&) = delete;
|
|
LegacySceneViewportGizmo(LegacySceneViewportGizmo&&) noexcept;
|
|
LegacySceneViewportGizmo& operator=(LegacySceneViewportGizmo&&) noexcept;
|
|
|
|
void Refresh(
|
|
EditorSceneRuntime& sceneRuntime,
|
|
const ::XCEngine::UI::UIRect& viewportRect,
|
|
const ::XCEngine::UI::UIPoint& pointerScreen,
|
|
bool hoverEnabled);
|
|
bool TryBeginDrag(EditorSceneRuntime& sceneRuntime);
|
|
bool UpdateDrag(EditorSceneRuntime& sceneRuntime);
|
|
bool EndDrag(EditorSceneRuntime& sceneRuntime);
|
|
void CancelDrag(EditorSceneRuntime& sceneRuntime);
|
|
void ResetVisualState();
|
|
|
|
bool IsActive() const;
|
|
bool IsHoveringHandle() const;
|
|
const LegacySceneViewportGizmoFrame& GetFrame() const;
|
|
|
|
private:
|
|
struct State;
|
|
|
|
std::unique_ptr<State> m_state = {};
|
|
};
|
|
|
|
void AppendLegacySceneViewportGizmo(
|
|
::XCEngine::UI::UIDrawList& drawList,
|
|
const LegacySceneViewportGizmoFrame& frame);
|
|
|
|
} // namespace XCEngine::UI::Editor::App
|