Files
XCEngine/new_editor/app/Features/Scene/SceneViewportFeature.cpp

61 lines
1.9 KiB
C++
Raw Normal View History

#include "Features/Scene/SceneViewportFeature.h"
#include "Composition/EditorPanelIds.h"
#include "Ports/TexturePort.h"
#include "Rendering/Viewport/ViewportHostService.h"
#include "Scene/EditorSceneRuntime.h"
#include "State/EditorCommandFocusService.h"
namespace XCEngine::UI::Editor::App {
void SceneViewportFeature::Initialize(
const std::filesystem::path& repoRoot,
Ports::TexturePort& textureHost,
ViewportHostService& viewportHostService) {
viewportHostService.SetContentRenderer(
kScenePanelId,
&m_renderService,
SceneViewportRenderService::GetViewportResourceRequirements());
m_controller.Initialize(repoRoot, textureHost);
}
void SceneViewportFeature::Shutdown(
Ports::TexturePort& textureHost,
ViewportHostService& viewportHostService) {
viewportHostService.SetContentRenderer(kScenePanelId, nullptr, {});
m_controller.Shutdown(textureHost);
m_renderService.Shutdown();
}
void SceneViewportFeature::ResetInteractionState() {
m_controller.ResetInteractionState();
}
void SceneViewportFeature::SetCommandFocusService(
EditorCommandFocusService* commandFocusService) {
m_controller.SetCommandFocusService(commandFocusService);
}
void SceneViewportFeature::SyncRenderRequest(EditorSceneRuntime& sceneRuntime) {
m_renderService.SetRenderRequest(
sceneRuntime.BuildSceneViewportRenderRequest());
}
void SceneViewportFeature::Update(
EditorSceneRuntime& sceneRuntime,
const UIEditorWorkspaceComposeState& composeState,
const UIEditorWorkspaceComposeFrame& composeFrame) {
m_controller.Update(
sceneRuntime,
m_renderService,
composeState,
composeFrame);
SyncRenderRequest(sceneRuntime);
}
void SceneViewportFeature::Append(::XCEngine::UI::UIDrawList& drawList) const {
m_controller.Append(drawList);
}
} // namespace XCEngine::UI::Editor::App