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:
@@ -312,11 +312,35 @@ namespace Engine
|
||||
ubo.proj[2][1] += jy * 2.0f / static_cast<f32>(targetExtent.height);
|
||||
}
|
||||
|
||||
ubo.ambientColor = scene.GetSettings().AmbientColor;
|
||||
// ---- 环境组件落帧(UE SkyLight/Skybox Actor 语义):场景环境
|
||||
// 是实体组件而非全局设置。多实例取第一个 active(entt
|
||||
// 视图序 = 组件创建序,首个命中稳定);无组件场景兜底 =
|
||||
// 无天空 + 旧 Settings 默认环境光(空场景清屏可渲染)----
|
||||
m_Frame.DrawSkybox = false;
|
||||
m_Frame.envPath.clear();
|
||||
ubo.ambientColor = glm::vec4{0.07f, 0.07f, 0.09f, 0.0f};
|
||||
for (auto&& [e, sb] :
|
||||
scene.GetRegistry().view<ECS::SkyboxComponent>().each())
|
||||
{
|
||||
if (sb.active)
|
||||
{
|
||||
m_Frame.DrawSkybox = true;
|
||||
m_Frame.envPath = sb.envPath;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (auto&& [e, sl] :
|
||||
scene.GetRegistry().view<ECS::SkyLightComponent>().each())
|
||||
{
|
||||
if (sl.active)
|
||||
{
|
||||
ubo.ambientColor = sl.ambientColor;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// ---- 运行时开关/调试视图落帧(各 pass 与 frag 只读契约字段)----
|
||||
m_Frame.ClearColor = scene.GetSettings().ClearColor;
|
||||
m_Frame.DrawSkybox = scene.GetSettings().DrawSkybox;
|
||||
m_Frame.shadowsEnabled = m_ShadowsEnabled;
|
||||
m_Frame.taaEnabled = m_TAAEnabled;
|
||||
m_Frame.bloomEnabled = m_BloomEnabled;
|
||||
|
||||
Reference in New Issue
Block a user