Refactor new editor boundaries and test ownership
This commit is contained in:
60
new_editor/app/Features/Scene/SceneViewportFeature.cpp
Normal file
60
new_editor/app/Features/Scene/SceneViewportFeature.cpp
Normal file
@@ -0,0 +1,60 @@
|
||||
#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
|
||||
Reference in New Issue
Block a user