void CreateSunlight() { if (sunlight == null) { sunlight = new GameObject("DirectionalLight"); //Init defaults sunlightParameters = new SunlightParameters(); sunlightParameters.lightParameters.type = LightType.Directional; } sunlight.transform.parent = sunlightTimeofdayDummy.transform; sunlight.transform.localPosition = -Vector3.forward * gizmoSize; var lightComponent = sunlight.GetComponent <Light>(); directionalLight = lightComponent == null?sunlight.AddComponent <Light>() : lightComponent; var additionalDataComponent = sunlight.GetComponent <HDAdditionalLightData>(); var additionalLightData = additionalDataComponent == null?sunlight.AddComponent <HDAdditionalLightData>() : additionalDataComponent; var shadowComponent = sunlight.GetComponent <AdditionalShadowData>(); var shadowData = shadowComponent == null?sunlight.AddComponent <AdditionalShadowData>() : shadowComponent; directionalLight.type = LightType.Directional; }
public static SunlightParameters LerpSunlightParameters(SunlightParameters from, SunlightParameters to, float weight) { var lerpSunlightParameters = new SunlightParameters(); lerpSunlightParameters.orientationParameters = LerpSunlightOrientationParameters(from.orientationParameters, to.orientationParameters, weight); lerpSunlightParameters.lightParameters = LightingUtilities.LerpLightParameters(from.lightParameters, to.lightParameters, weight); return(lerpSunlightParameters); }
public static SunlightParameters DeepCopy(SunlightParameters c) { SunlightParameters temp = new SunlightParameters(); temp.orientationParameters = SunlightOrientationParameters.DeepCopy(c.orientationParameters); temp.lightParameters = LightParameters.DeepCopy(c.lightParameters); temp.colorGradient = c.colorGradient; temp.intensityCurve = c.intensityCurve; return(temp); }
public static SunlightParameters operator +(SunlightParameters x, SunlightParameters y) { var addition = new SunlightParameters { lightParameters = x.lightParameters + y.lightParameters, orientationParameters = x.orientationParameters + y.orientationParameters }; return(addition); }