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

57 lines
1.6 KiB
C++
Raw Normal View History

2026-04-27 19:16:08 +08:00
#include "Scene/SceneViewportFeature.h"
#include "Scene/EditorSceneRuntime.h"
#include "State/EditorCommandFocusService.h"
namespace XCEngine::UI::Editor::App {
void SceneViewportFeature::Initialize(
2026-04-28 02:57:49 +08:00
const EditorIconService* iconService,
EditorSceneViewportRuntime& sceneViewportRuntime) {
m_sceneViewportRuntime = &sceneViewportRuntime;
m_controller.Initialize(iconService);
}
2026-04-28 02:57:49 +08:00
void SceneViewportFeature::Shutdown() {
m_controller.Shutdown();
m_sceneViewportRuntime = nullptr;
}
void SceneViewportFeature::ResetInteractionState() {
m_controller.ResetInteractionState();
}
void SceneViewportFeature::SetCommandFocusService(
EditorCommandFocusService* commandFocusService) {
m_controller.SetCommandFocusService(commandFocusService);
}
void SceneViewportFeature::SyncRenderRequest(EditorSceneRuntime& sceneRuntime) {
2026-04-28 02:57:49 +08:00
if (m_sceneViewportRuntime != nullptr) {
m_sceneViewportRuntime->SetRenderRequest(
sceneRuntime.BuildSceneViewportRenderRequest());
}
}
void SceneViewportFeature::Update(
EditorSceneRuntime& sceneRuntime,
const UIEditorWorkspaceComposeState& composeState,
const UIEditorWorkspaceComposeFrame& composeFrame) {
2026-04-28 02:57:49 +08:00
if (m_sceneViewportRuntime == nullptr) {
return;
}
m_controller.Update(
sceneRuntime,
2026-04-28 02:57:49 +08:00
m_sceneViewportRuntime->GetObjectPicker(),
composeState,
composeFrame);
SyncRenderRequest(sceneRuntime);
}
void SceneViewportFeature::Append(::XCEngine::UI::UIDrawList& drawList) const {
m_controller.Append(drawList);
}
} // namespace XCEngine::UI::Editor::App