protected override void Init(MyObjectBuilder_DefinitionBase builder) { base.Init(builder); MyObjectBuilder_VisualSettingsDefinition objBuilder = (MyObjectBuilder_VisualSettingsDefinition)builder; FogProperties = objBuilder.FogProperties; SunProperties = objBuilder.SunProperties; PostProcessSettings = objBuilder.PostProcessSettings; ShadowSettings.CopyFrom(objBuilder.ShadowSettings); }
static MySunProperties() { Default = new MySunProperties() { SunIntensity = Defaults.SunIntensity, BackLightIntensity1 = Defaults.BackLightIntensity1, BackLightIntensity2 = Defaults.BackLightIntensity2, EnvironmentLight = MyEnvironmentLightData.Default, SunDirectionNormalized = Defaults.SunDirectionNormalized, BaseSunDirectionNormalized = Defaults.BaseSunDirectionNormalized, SunMaterial = Defaults.SunMaterial, DistanceToSun = Defaults.DistanceToSun, }; }
/// <param name="interpolator">0 - use this object, 1 - use other object</param> public MySunProperties InterpolateWith(MySunProperties other, float interpolator) { var result = new MySunProperties(); result.SunIntensity = MathHelper.Lerp(this.SunIntensity, other.SunIntensity, interpolator); result.BackLightIntensity1 = MathHelper.Lerp(this.BackLightIntensity1, other.BackLightIntensity1, interpolator); result.BackLightIntensity2 = MathHelper.Lerp(this.BackLightIntensity2, other.BackLightIntensity2, interpolator); result.EnvironmentLight = EnvironmentLight.InterpolateWith(ref other.EnvironmentLight, interpolator); if (result.SunDirectionNormalized.Dot(other.SunDirectionNormalized) > 0.0001f) result.SunDirectionNormalized = Vector3.Lerp(SunDirectionNormalized, other.SunDirectionNormalized, interpolator); else result.SunDirectionNormalized = SunDirectionNormalized; return result; }
/// <param name="interpolator">0 - use this object, 1 - use other object</param> public MySunProperties InterpolateWith(MySunProperties other, float interpolator) { var result = new MySunProperties(); result.SunIntensity = MathHelper.Lerp(this.SunIntensity, other.SunIntensity, interpolator); result.BackLightIntensity1 = MathHelper.Lerp(this.BackLightIntensity1, other.BackLightIntensity1, interpolator); result.BackLightIntensity2 = MathHelper.Lerp(this.BackLightIntensity2, other.BackLightIntensity2, interpolator); result.EnvironmentLight = EnvironmentLight.InterpolateWith(ref other.EnvironmentLight, interpolator); if (result.SunDirectionNormalized.Dot(other.SunDirectionNormalized) > 0.0001f) { result.SunDirectionNormalized = Vector3.Lerp(SunDirectionNormalized, other.SunDirectionNormalized, interpolator); } else { result.SunDirectionNormalized = SunDirectionNormalized; } return(result); }