80 lines
2.4 KiB
C++
80 lines
2.4 KiB
C++
#pragma once
|
|
|
|
#include "Rendering/Host/UiTextureHost.h"
|
|
#include "Rendering/Host/ViewportRenderHost.h"
|
|
|
|
#include <XCEditor/Foundation/UIEditorTextMeasurement.h>
|
|
#include <XCEngine/Rendering/RenderContext.h>
|
|
#include <XCEngine/UI/DrawData.h>
|
|
|
|
#include <cstdint>
|
|
#include <filesystem>
|
|
#include <memory>
|
|
#include <string>
|
|
|
|
namespace XCEngine::UI::Editor::Rendering::Host {
|
|
|
|
struct EditorWindowRenderRuntimeSurface {
|
|
void* nativeWindowHandle = nullptr;
|
|
std::uint32_t widthPixels = 0u;
|
|
std::uint32_t heightPixels = 0u;
|
|
};
|
|
|
|
struct EditorWindowRenderRuntimeInitializeResult {
|
|
bool success = false;
|
|
bool hasViewportSurfacePresentation = false;
|
|
std::string errorMessage = {};
|
|
std::string warning = {};
|
|
};
|
|
|
|
struct EditorWindowRenderRuntimeResizeResult {
|
|
bool hasViewportSurfacePresentation = false;
|
|
std::string warning = {};
|
|
};
|
|
|
|
struct EditorWindowRenderRuntimeFrameContext {
|
|
bool canRenderViewports = false;
|
|
::XCEngine::Rendering::RenderContext renderContext = {};
|
|
std::string warning = {};
|
|
};
|
|
|
|
struct EditorWindowRenderRuntimePresentResult {
|
|
bool framePresented = false;
|
|
bool captureSucceeded = false;
|
|
std::string captureError = {};
|
|
std::string warning = {};
|
|
};
|
|
|
|
class EditorWindowRenderRuntime {
|
|
public:
|
|
virtual ~EditorWindowRenderRuntime() = default;
|
|
|
|
virtual bool IsReady() const = 0;
|
|
virtual void SetDpiScale(float dpiScale) = 0;
|
|
virtual UIEditorTextMeasurer& GetTextMeasurer() = 0;
|
|
virtual const UIEditorTextMeasurer& GetTextMeasurer() const = 0;
|
|
virtual UiTextureHost& GetTextureHost() = 0;
|
|
virtual ViewportRenderHost& GetViewportRenderHost() = 0;
|
|
|
|
virtual EditorWindowRenderRuntimeInitializeResult Initialize(
|
|
const EditorWindowRenderRuntimeSurface& surface) = 0;
|
|
virtual void WaitForGpuIdle() = 0;
|
|
virtual void Shutdown() = 0;
|
|
virtual EditorWindowRenderRuntimeResizeResult ApplyResize(
|
|
std::uint32_t width,
|
|
std::uint32_t height) = 0;
|
|
virtual EditorWindowRenderRuntimeFrameContext BeginFrame() = 0;
|
|
virtual EditorWindowRenderRuntimePresentResult Present(
|
|
const ::XCEngine::UI::UIDrawData& drawData,
|
|
const std::filesystem::path* captureOutputPath) = 0;
|
|
};
|
|
|
|
class EditorWindowRenderRuntimeFactory {
|
|
public:
|
|
virtual ~EditorWindowRenderRuntimeFactory() = default;
|
|
|
|
virtual std::unique_ptr<EditorWindowRenderRuntime> CreateWindowRenderRuntime() = 0;
|
|
};
|
|
|
|
} // namespace XCEngine::UI::Editor::Rendering::Host
|