84 lines
2.3 KiB
C++
84 lines
2.3 KiB
C++
#pragma once
|
|
|
|
#include <XCEngine/Components/GameObject.h>
|
|
#include <XCEngine/Core/Math/Quaternion.h>
|
|
#include <XCEngine/Core/Math/Vector3.h>
|
|
#include <XCEngine/UI/Types.h>
|
|
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
#include <string_view>
|
|
|
|
namespace XCEngine::UI::Editor::App {
|
|
|
|
enum class SceneToolMode : std::uint8_t {
|
|
View = 0,
|
|
Translate,
|
|
Rotate,
|
|
Scale,
|
|
Transform
|
|
};
|
|
|
|
enum class SceneToolSpaceMode : std::uint8_t {
|
|
World = 0,
|
|
Local
|
|
};
|
|
|
|
enum class SceneToolPivotMode : std::uint8_t {
|
|
Pivot = 0,
|
|
Center
|
|
};
|
|
|
|
enum class SceneToolHandle : std::uint8_t {
|
|
None = 0,
|
|
AxisX,
|
|
AxisY,
|
|
AxisZ
|
|
};
|
|
|
|
enum class SceneToolInteractionLock : std::uint8_t {
|
|
None = 0,
|
|
TransformDrag
|
|
};
|
|
|
|
std::string_view GetSceneToolModeName(SceneToolMode mode);
|
|
std::string_view GetSceneToolSpaceModeName(SceneToolSpaceMode mode);
|
|
std::string_view GetSceneToolPivotModeName(SceneToolPivotMode mode);
|
|
std::string_view GetSceneToolHandleName(SceneToolHandle handle);
|
|
std::string_view GetSceneToolInteractionLockName(SceneToolInteractionLock lock);
|
|
|
|
struct SceneTransformSnapshot {
|
|
::XCEngine::Components::GameObject::ID targetId =
|
|
::XCEngine::Components::GameObject::INVALID_ID;
|
|
::XCEngine::Math::Vector3 position = ::XCEngine::Math::Vector3::Zero();
|
|
::XCEngine::Math::Quaternion rotation =
|
|
::XCEngine::Math::Quaternion::Identity();
|
|
::XCEngine::Math::Vector3 scale = ::XCEngine::Math::Vector3::One();
|
|
bool valid = false;
|
|
|
|
bool IsValid() const {
|
|
return valid &&
|
|
targetId != ::XCEngine::Components::GameObject::INVALID_ID;
|
|
}
|
|
};
|
|
|
|
struct SceneToolDragState {
|
|
bool active = false;
|
|
SceneToolMode mode = SceneToolMode::View;
|
|
SceneToolHandle handle = SceneToolHandle::None;
|
|
::XCEngine::UI::UIPoint startPointerPosition = {};
|
|
SceneTransformSnapshot initialTransform = {};
|
|
};
|
|
|
|
struct SceneToolState {
|
|
SceneToolMode mode = SceneToolMode::Translate;
|
|
SceneToolSpaceMode spaceMode = SceneToolSpaceMode::World;
|
|
SceneToolPivotMode pivotMode = SceneToolPivotMode::Pivot;
|
|
SceneToolHandle hoveredHandle = SceneToolHandle::None;
|
|
SceneToolHandle activeHandle = SceneToolHandle::None;
|
|
SceneToolInteractionLock interactionLock = SceneToolInteractionLock::None;
|
|
SceneToolDragState dragState = {};
|
|
};
|
|
|
|
} // namespace XCEngine::UI::Editor::App
|