From 6952dcd1730c984ce318141d994ba66e717d4bbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E4=B8=89?= <940119273@qq.com> Date: Fri, 21 Jun 2024 07:08:31 +0000 Subject: [PATCH] =?UTF-8?q?!2831=20=E4=BF=AE=E5=A4=8D:=E5=8F=B3=E4=BE=A7?= =?UTF-8?q?=E6=A0=8F=E5=9C=BA=E6=99=AF=E5=85=89=E6=BA=90=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E6=97=A0=E6=95=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Editor/DefaultConfig.ts | 3 ++- src/UI/Store/OptionInterface/IOptionInterface.ts | 1 + src/UI/Store/RightPanelStore/LightStore.ts | 12 +++++++++++- 3 files changed, 14 insertions(+), 2 deletions(-) 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);