93 lines
2.4 KiB
C++
93 lines
2.4 KiB
C++
#pragma once
|
|
|
|
#include <XCEngine/Core/Math/Vector3.h>
|
|
|
|
#include <imgui.h>
|
|
|
|
#include <cstdint>
|
|
#include <string>
|
|
|
|
namespace XCEngine {
|
|
namespace Rendering {
|
|
struct RenderContext;
|
|
} // namespace Rendering
|
|
|
|
namespace Editor {
|
|
|
|
class IEditorContext;
|
|
|
|
enum class EditorViewportKind {
|
|
Scene,
|
|
Game
|
|
};
|
|
|
|
struct EditorViewportFrame {
|
|
ImTextureID textureId = {};
|
|
ImVec2 requestedSize = ImVec2(0.0f, 0.0f);
|
|
ImVec2 renderSize = ImVec2(0.0f, 0.0f);
|
|
bool hasTexture = false;
|
|
bool wasRequested = false;
|
|
std::string statusText;
|
|
};
|
|
|
|
struct SceneViewportInput {
|
|
ImVec2 viewportSize = ImVec2(0.0f, 0.0f);
|
|
ImVec2 mouseDelta = ImVec2(0.0f, 0.0f);
|
|
float mouseWheel = 0.0f;
|
|
float flySpeedDelta = 0.0f;
|
|
float deltaTime = 0.0f;
|
|
float moveForward = 0.0f;
|
|
float moveRight = 0.0f;
|
|
float moveUp = 0.0f;
|
|
bool hovered = false;
|
|
bool focused = false;
|
|
bool looking = false;
|
|
bool fastMove = false;
|
|
bool orbiting = false;
|
|
bool panning = false;
|
|
bool focusSelectionRequested = false;
|
|
};
|
|
|
|
struct SceneViewportOverlayData {
|
|
bool valid = false;
|
|
Math::Vector3 cameraPosition = Math::Vector3::Zero();
|
|
Math::Vector3 cameraForward = Math::Vector3::Forward();
|
|
Math::Vector3 cameraRight = Math::Vector3::Right();
|
|
Math::Vector3 cameraUp = Math::Vector3::Up();
|
|
float verticalFovDegrees = 60.0f;
|
|
float nearClipPlane = 0.03f;
|
|
float farClipPlane = 2000.0f;
|
|
float orbitDistance = 6.0f;
|
|
};
|
|
|
|
enum class SceneViewportOrientationAxis : uint8_t {
|
|
None = 0,
|
|
PositiveX,
|
|
NegativeX,
|
|
PositiveY,
|
|
NegativeY,
|
|
PositiveZ,
|
|
NegativeZ
|
|
};
|
|
|
|
class IViewportHostService {
|
|
public:
|
|
virtual ~IViewportHostService() = default;
|
|
|
|
virtual void BeginFrame() = 0;
|
|
virtual EditorViewportFrame RequestViewport(EditorViewportKind kind, const ImVec2& requestedSize) = 0;
|
|
virtual void UpdateSceneViewInput(IEditorContext& context, const SceneViewportInput& input) = 0;
|
|
virtual uint64_t PickSceneViewEntity(
|
|
IEditorContext& context,
|
|
const ImVec2& viewportSize,
|
|
const ImVec2& viewportMousePosition) = 0;
|
|
virtual void AlignSceneViewToOrientationAxis(SceneViewportOrientationAxis axis) = 0;
|
|
virtual SceneViewportOverlayData GetSceneViewOverlayData() const = 0;
|
|
virtual void RenderRequestedViewports(
|
|
IEditorContext& context,
|
|
const Rendering::RenderContext& renderContext) = 0;
|
|
};
|
|
|
|
} // namespace Editor
|
|
} // namespace XCEngine
|