diff --git a/src/Editor/DefaultConfig.ts b/src/Editor/DefaultConfig.ts index 86c0d5f52..5b5696315 100644 --- a/src/Editor/DefaultConfig.ts +++ b/src/Editor/DefaultConfig.ts @@ -265,7 +265,7 @@ export const DefaultRectAreaLightOption: RectAreaLightOption = { Object.freeze(DefaultRectAreaLightOption); export const DefaultRightPlaneLightOption: RightPlaneLightOption = { - version: 2, + version: 3, ShowHemiLight: true, ShowSunLight: true, SkyLightColor: "#FFFFFF", @@ -277,6 +277,7 @@ export const DefaultRightPlaneLightOption: RightPlaneLightOption = { SunLightTemperature: 6500, SunLightElevationDeg: 60, SunLightRotateDeg: 300, + SunLightSourceAngle: 0.5, ShowExposure: true, AutoExposure: false, ExposureCompensation: 0, diff --git a/src/UI/Store/OptionInterface/IOptionInterface.ts b/src/UI/Store/OptionInterface/IOptionInterface.ts index ec1627864..a28892fb5 100644 --- a/src/UI/Store/OptionInterface/IOptionInterface.ts +++ b/src/UI/Store/OptionInterface/IOptionInterface.ts @@ -38,6 +38,7 @@ export interface RightPlaneLightOption SunLightTemperature: number; SunLightElevationDeg: number; SunLightRotateDeg: number; + SunLightSourceAngle: number; ShowExposure: boolean; AutoExposure: boolean; ExposureCompensation: number; diff --git a/src/UI/Store/RightPanelStore/LightStore.ts b/src/UI/Store/RightPanelStore/LightStore.ts index db0790b57..36aeb6f10 100644 --- a/src/UI/Store/RightPanelStore/LightStore.ts +++ b/src/UI/Store/RightPanelStore/LightStore.ts @@ -602,6 +602,7 @@ export class RightPlaneLightStore implements IConfigStore this.m_Option.SunLightTemperature = sunLightStore.sunLightColorTemperature; this.m_Option.SunLightElevationDeg = sunLightStore.sunLightElevationDeg; this.m_Option.SunLightRotateDeg = sunLightStore.sunLightRotateDeg; + this.m_Option.SunLightSourceAngle = sunLightStore.sunLightSourceAngle; this.m_Option.ShowExposure = lightStore.ShowExposure; this.m_Option.AutoExposure = lightStore.hemisphereLightData.AutoExposure; this.m_Option.ExposureCompensation = parseInt(lightStore.hemisphereLightData.ExposureCompensation); @@ -642,6 +643,15 @@ export class RightPlaneLightStore implements IConfigStore lightStore.sunLightData.time = cof.option.SunTime as ETime; } + if (this.m_Option.version < 3) + { + this.m_Option.version = 3; + sunLightStore.sunLightSourceAngle = DefaultRightPlaneLightOption.SunLightSourceAngle; + } + else + sunLightStore.sunLightSourceAngle = cof.option.SunLightSourceAngle; + + let sunLight = app.Database.SunLight; let skyLight = app.Database.HemisphereLight; let pos: Vector3; @@ -661,7 +671,7 @@ export class RightPlaneLightStore implements IConfigStore sunLight.IndirectLightingIntensity = cof.option.SunLightIndirectLightingIntensity; sunLight.Color = new Color(cof.option.SunLightColor); sunLight.Temperature = cof.option.SunLightTemperature; - + sunLight.LightSourceAngle = sunLightStore.sunLightSourceAngle; sunLight.SunPosition = pos; CalcSunShadowCameraExtents(app.Database.SunLight, false);