Environment settings become scene entities (UE Skybox/SkyLight semantics)
Skybox/SkyLight are now Actor-carried components instead of resident global settings, matching UE where SkyAtmosphere/SkyLight/fog are Actors added from Place Actors and configured in Details. - New SkyboxComponent (active + envPath asset slot) and SkyLightComponent (active + ambientColor); first-active entity wins per frame - SceneRenderer collects env from components into FrameSceneData (DrawSkybox/envPath/ambient); Renderer performs delta sync - env reloads only when the resolved path changes, neutral fallback when empty or unloadable - App-side env plumbing removed: kEnvPaths table and getEnvIndex/ setEnvIndex callbacks deleted; StatsPanel keeps ClearColor + debug view, env params move to Details - Serializer: scene-level Settings stores ClearColor only; env components serialize per entity; legacy v1 scenes (Environment header + Settings.AmbientColor/DrawSkybox) auto-migrate into an Environment entity on load for visual parity - Inspector: Skybox/Sky Light sections with .hdr asset slot dropdown and Add Component entries; Outliner "+ Create" popup offers Empty/Light/Camera/Environment
This commit is contained in:
+10
-24
@@ -120,34 +120,20 @@ void StatsPanel::Draw(const EditorContext& ctx)
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Environment:IBL 环境 + 调试视图(决定"看什么")----
|
||||
// ---- Environment:清屏色 + 调试视图(决定"看什么")。
|
||||
// 环境贴图/环境光已迁为实体组件(Skybox/SkyLight),在 Details 配 ----
|
||||
if (ImGui::CollapsingHeader("Environment", ImGuiTreeNodeFlags_DefaultOpen))
|
||||
{
|
||||
bool& drawSkybox = ctx.scene->GetSettings().DrawSkybox;
|
||||
ImGui::Checkbox("DrawSkybox", &drawSkybox);
|
||||
if (drawSkybox && ctx.getEnvIndex)
|
||||
{
|
||||
int envIdx = ctx.getEnvIndex();
|
||||
if (ImGui::Combo("env", &envIdx, kEnvNames, kEnvCount))
|
||||
{
|
||||
ctx.setEnvIndex(envIdx);
|
||||
const auto env = ctx.assets->LoadEnvironment(kEnvPaths[envIdx]);
|
||||
ctx.renderer->SetEnvironment(ctx.assets->GetEnvironment(env));
|
||||
}
|
||||
ImGui::ColorEdit4("ClearColor",
|
||||
glm::value_ptr(ctx.scene->GetSettings().ClearColor));
|
||||
|
||||
// 调试视图:单看某个 pass 的中间输出(类 UE pass debug)
|
||||
const auto& viewNames = renderer.GetDebugViewNames();
|
||||
int view = renderer.GetDebugView();
|
||||
if (ImGui::Combo("Debug View", &view, viewNames.data(),
|
||||
static_cast<int>(viewNames.size())))
|
||||
{
|
||||
renderer.SetDebugView(view);
|
||||
}
|
||||
}
|
||||
else
|
||||
// 调试视图:单看某个 pass 的中间输出(类 UE pass debug)
|
||||
const auto& viewNames = renderer.GetDebugViewNames();
|
||||
int view = renderer.GetDebugView();
|
||||
if (ImGui::Combo("Debug View", &view, viewNames.data(),
|
||||
static_cast<int>(viewNames.size())))
|
||||
{
|
||||
ImGui::ColorEdit4("ClearColor",
|
||||
glm::value_ptr(ctx.scene->GetSettings().ClearColor));
|
||||
renderer.SetDebugView(view);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user