/// <param name="interpolator">0 - use this object, 1 - use other object</param> public MySunProperties InterpolateWith(MySunProperties otherProperties, float interpolator) { var result = new MySunProperties(); result.SunDiffuse = Color.Lerp(SunDiffuse, otherProperties.SunDiffuse, interpolator); result.SunIntensity = MathHelper.Lerp(SunIntensity, otherProperties.SunIntensity, interpolator); result.SunSpecular = Color.Lerp(SunSpecular, otherProperties.SunSpecular, interpolator); result.BackSunIntensity = MathHelper.Lerp(BackSunIntensity, otherProperties.BackSunIntensity, interpolator); result.BackSunDiffuse = Color.Lerp(BackSunDiffuse, otherProperties.BackSunDiffuse, interpolator); result.AmbientColor = Color.Lerp(AmbientColor, otherProperties.AmbientColor, interpolator); result.AmbientMultiplier = MathHelper.Lerp(AmbientMultiplier, otherProperties.AmbientMultiplier, interpolator); result.EnvironmentAmbientIntensity = MathHelper.Lerp(EnvironmentAmbientIntensity, otherProperties.EnvironmentAmbientIntensity, interpolator); result.SunSizeMultiplier = MathHelper.Lerp(SunSizeMultiplier, otherProperties.SunSizeMultiplier, interpolator); result.BackgroundColor = Color.Lerp(BackgroundColor, otherProperties.BackgroundColor, interpolator); if (result.SunDirectionNormalized.Dot(otherProperties.SunDirectionNormalized) > 0.0001f) { result.SunDirectionNormalized = Vector3.Lerp(SunDirectionNormalized, otherProperties.SunDirectionNormalized, interpolator); } else { result.SunDirectionNormalized = SunDirectionNormalized; } return(result); }
public static void InitEnvironmentSettings(MyObjectBuilder_EnvironmentSettings environmentBuilder = null) { var environment = MyDefinitionManager.Static.EnvironmentDefinition; var o = environment.BackgroundOrientation; BackgroundTexture = environment.BackgroundTexture; BackgroundOrientation = Quaternion.CreateFromYawPitchRoll(o.Yaw, o.Pitch, o.Roll); DistanceToSun = environment.DistanceToSun; SunProperties = new MySunProperties(environment.SunProperties); FogProperties = environment.FogProperties; if (environmentBuilder != null) { Vector3 sunDirection; Vector3.CreateFromAzimuthAndElevation(environmentBuilder.SunAzimuth, environmentBuilder.SunElevation, out sunDirection); SunProperties.BaseSunDirectionNormalized = sunDirection; SunProperties.SunDirectionNormalized = sunDirection; SunProperties.SunIntensity = environmentBuilder.SunIntensity; FogProperties.FogMultiplier = environmentBuilder.FogMultiplier; FogProperties.FogDensity = environmentBuilder.FogDensity; FogProperties.FogColor = new Color(environmentBuilder.FogColor); FogProperties.FogColor.A = 255; } }
public static void InitEnvironmentSettings(MyObjectBuilder_EnvironmentSettings environmentBuilder = null) { var environment = MyDefinitionManager.Static.EnvironmentDefinition; var o = environment.BackgroundOrientation; BackgroundTexture = environment.BackgroundTexture; BackgroundOrientation = Quaternion.CreateFromYawPitchRoll(o.Yaw, o.Pitch, o.Roll); DistanceToSun = environment.DistanceToSun; SunProperties = environment.SunProperties; FogProperties = environment.FogProperties; if (environmentBuilder != null) { Vector3 sunDirection; Vector3.CreateFromAzimuthAndElevation(environmentBuilder.SunAzimuth, environmentBuilder.SunElevation, out sunDirection); SunProperties.SunDirectionNormalized = sunDirection; SunProperties.SunIntensity = environmentBuilder.SunIntensity; FogProperties.FogMultiplier = environmentBuilder.FogMultiplier; FogProperties.FogDensity = environmentBuilder.FogDensity; FogProperties.FogColor = new Color(environmentBuilder.FogColor); FogProperties.FogColor.A = 255; } }
public static void SetDefaults() { SunProperties = MySunProperties.Default; FogProperties = MyFogProperties.Default; ImpostorProperties = new VRageRender.MyImpostorProperties[1]; ParticleDustProperties = new MyParticleDustProperties(); }
public MySunProperties(MySunProperties from) { SunIntensity = from.SunIntensity; SunDiffuse = from.SunDiffuse; SunSpecular = from.SunSpecular; SunMaterial = from.SunMaterial; AdditionalSunIntensity = new float[from.AdditionalSunIntensity.Length]; AdditionalSunDiffuse = new Color[from.AdditionalSunDiffuse.Length]; AdditionalSunDirection = new Vector2[from.AdditionalSunDirection.Length]; for (int lightIndex = 0; lightIndex < from.AdditionalSunDirection.Length; ++lightIndex) { AdditionalSunIntensity[lightIndex] = from.AdditionalSunIntensity[lightIndex]; AdditionalSunDiffuse[lightIndex] = from.AdditionalSunDiffuse[lightIndex]; AdditionalSunDirection[lightIndex] = from.AdditionalSunDirection[lightIndex]; } AmbientColor = from.AmbientColor; AmbientMultiplier = from.AmbientMultiplier; EnvironmentAmbientIntensity = from.EnvironmentAmbientIntensity; SunSizeMultiplier = from.SunSizeMultiplier; BackgroundColor = from.BackgroundColor; SunDirectionNormalized = from.SunDirectionNormalized; BaseSunDirectionNormalized = from.BaseSunDirectionNormalized; }
/// <param name="interpolator">0 - use this object, 1 - use other object</param> public MySunProperties InterpolateWith(MySunProperties otherProperties, float interpolator) { var result = new MySunProperties(); result.SunDiffuse = Color.Lerp(SunDiffuse, otherProperties.SunDiffuse, interpolator); result.SunIntensity = MathHelper.Lerp(SunIntensity, otherProperties.SunIntensity, interpolator); result.SunSpecular = Color.Lerp(SunSpecular, otherProperties.SunSpecular, interpolator); result.BackSunIntensity = MathHelper.Lerp(BackSunIntensity, otherProperties.BackSunIntensity, interpolator); result.BackSunDiffuse = Color.Lerp(BackSunDiffuse, otherProperties.BackSunDiffuse, interpolator); result.AmbientColor = Color.Lerp(AmbientColor, otherProperties.AmbientColor, interpolator); result.AmbientMultiplier = MathHelper.Lerp(AmbientMultiplier, otherProperties.AmbientMultiplier, interpolator); result.EnvironmentAmbientIntensity = MathHelper.Lerp(EnvironmentAmbientIntensity, otherProperties.EnvironmentAmbientIntensity, interpolator); result.SunSizeMultiplier = MathHelper.Lerp(SunSizeMultiplier, otherProperties.SunSizeMultiplier, interpolator); result.BackgroundColor = Color.Lerp(BackgroundColor, otherProperties.BackgroundColor, interpolator); if (result.SunDirectionNormalized.Dot(otherProperties.SunDirectionNormalized) > 0.0001f) result.SunDirectionNormalized = Vector3.Lerp(SunDirectionNormalized, otherProperties.SunDirectionNormalized, interpolator); else result.SunDirectionNormalized = SunDirectionNormalized; return result; }
public static void SetDefaults() { SunProperties = new MySunProperties(MySunProperties.Default); FogProperties = MyFogProperties.Default; ImpostorProperties = new VRageRender.MyImpostorProperties[1]; ParticleDustProperties = new MyParticleDustProperties(); GodRaysProperties = new MyGodRaysProperties(); BackgroundTexture = "BackgroundCube"; }
public static void SetDefaults() { SunProperties = MySunProperties.Default; FogProperties = MyFogProperties.Default; ImpostorProperties = new VRageRender.MyImpostorProperties[1]; ParticleDustProperties = new MyParticleDustProperties(); GodRaysProperties = new MyGodRaysProperties(); BackgroundTexture = "BackgroundCube"; }
public static void InitEnvironmentSettings(MyObjectBuilder_EnvironmentSettings environmentBuilder = null) { if (environmentBuilder != null) { EnvironmentDefinition = MyDefinitionManager.Static.GetDefinition <MyEnvironmentDefinition>(environmentBuilder.EnvironmentDefinition); } else if (EnvironmentDefinition == null) { // Fallback EnvironmentDefinition = MyDefinitionManager.Static.GetDefinition <MyEnvironmentDefinition>(MyStringHash.GetOrCompute("Default")); } var environment = EnvironmentDefinition; SunProperties = environment.SunProperties; FogProperties = environment.FogProperties; SSAOSettings = environment.SSAOSettings; HBAOSettings = environment.HBAOSettings; ShadowSettings.CopyFrom(environment.ShadowSettings); NewPipelineSettings.CopyFrom(environment.NewPipelineSettings); SunRotationAxis = SunProperties.SunRotationAxis; MyRenderProxy.UpdateShadowsSettings(ShadowSettings); MyRenderProxy.UpdateNewPipelineSettings(NewPipelineSettings); MySector.Lodding.UpdatePreset(environment.UserLoddingSettings, environment.LowLoddingSettings, environment.MediumLoddingSettings, environment.HighLoddingSettings); MyMaterialsSettings materialsSettings = new MyMaterialsSettings(); materialsSettings.CopyFrom(environment.MaterialsSettings); MyRenderProxy.UpdateMaterialsSettings(materialsSettings); // TODO: Delete MyPostprocessSettingsWrapper and move to have bundled // settings in MySector and change all references to point here MyPostprocessSettingsWrapper.Settings = environment.PostProcessSettings; if (environmentBuilder != null) { Vector3 sunDirection; Vector3.CreateFromAzimuthAndElevation(environmentBuilder.SunAzimuth, environmentBuilder.SunElevation, out sunDirection); sunDirection.Normalize(); SunProperties.BaseSunDirectionNormalized = sunDirection; SunProperties.SunDirectionNormalized = sunDirection; //SunProperties.SunIntensity = environmentBuilder.SunIntensity; FogProperties.FogMultiplier = environmentBuilder.FogMultiplier; FogProperties.FogDensity = environmentBuilder.FogDensity; FogProperties.FogColor = new Color(environmentBuilder.FogColor); } }
public MySunProperties(MySunProperties from) { SunIntensity = from.SunIntensity; SunDiffuse = from.SunDiffuse; SunSpecular = from.SunSpecular; SunMaterial = from.SunMaterial; BackSunIntensity = from.BackSunIntensity; BackSunDiffuse = from.BackSunDiffuse; AmbientColor = from.AmbientColor; AmbientMultiplier = from.AmbientMultiplier; EnvironmentAmbientIntensity = from.EnvironmentAmbientIntensity; SunSizeMultiplier = from.SunSizeMultiplier; BackgroundColor = from.BackgroundColor; SunDirectionNormalized = from.SunDirectionNormalized; BaseSunDirectionNormalized = from.BaseSunDirectionNormalized; }
public MySunProperties(MySunProperties from) { SunIntensity = from.SunIntensity; SunDiffuse = from.SunDiffuse; SunSpecular = from.SunSpecular; SunMaterial = from.SunMaterial; BackSunIntensity = from.BackSunIntensity; BackSunDiffuse = from.BackSunDiffuse; AmbientColor = from.AmbientColor; AmbientMultiplier = from.AmbientMultiplier; EnvironmentAmbientIntensity = from.EnvironmentAmbientIntensity; SunSizeMultiplier = from.SunSizeMultiplier; BackgroundColor = from.BackgroundColor; SunDirectionNormalized = from.SunDirectionNormalized; BaseSunDirectionNormalized = from.BaseSunDirectionNormalized; }
public static void InitEnvironmentSettings(MyObjectBuilder_EnvironmentSettings environmentBuilder = null) { if (environmentBuilder != null) { EnvironmentDefinition = MyDefinitionManager.Static.GetDefinition <MyEnvironmentDefinition>(environmentBuilder.EnvironmentDefinition); } else if (EnvironmentDefinition == null) { // Fallback EnvironmentDefinition = MyDefinitionManager.Static.GetDefinition <MyEnvironmentDefinition>(MyStringHash.GetOrCompute("Default")); } var environment = EnvironmentDefinition; var o = environment.BackgroundOrientation; BackgroundTexture = environment.BackgroundTexture; BackgroundTextureNight = environment.BackgroundTextureNight; BackgroundTextureNightPrefiltered = environment.BackgroundTextureNightPrefiltered; BackgroundOrientation = Quaternion.CreateFromYawPitchRoll(o.Yaw, o.Pitch, o.Roll); DistanceToSun = environment.DistanceToSun; SunProperties = new MySunProperties(environment.SunProperties); FogProperties = environment.FogProperties; if (environmentBuilder != null) { Vector3 sunDirection; Vector3.CreateFromAzimuthAndElevation(environmentBuilder.SunAzimuth, environmentBuilder.SunElevation, out sunDirection); SunProperties.SunDirectionNormalized = sunDirection; SunProperties.SunIntensity = environmentBuilder.SunIntensity; FogProperties.FogMultiplier = environmentBuilder.FogMultiplier; FogProperties.FogDensity = environmentBuilder.FogDensity; FogProperties.FogColor = new Color(environmentBuilder.FogColor); FogProperties.FogColor.A = 255; } }
/// <param name="interpolator">0 - use this object, 1 - use other object</param> public MySunProperties InterpolateWith(MySunProperties otherProperties, float interpolator) { var result = new MySunProperties(); result.SunDiffuse = Color.Lerp(SunDiffuse, otherProperties.SunDiffuse, interpolator); result.SunIntensity = MathHelper.Lerp(SunIntensity, otherProperties.SunIntensity, interpolator); result.SunSpecular = Color.Lerp(SunSpecular, otherProperties.SunSpecular, interpolator); result.AdditionalSunIntensity = new float[AdditionalSunIntensity.Length]; result.AdditionalSunDiffuse = new Color[AdditionalSunDiffuse.Length]; result.AdditionalSunDirection = new Vector2[AdditionalSunDirection.Length]; for (int lightIndex = 0; lightIndex < AdditionalSunDirection.Length; ++lightIndex) { result.AdditionalSunIntensity[lightIndex] = MathHelper.Lerp(AdditionalSunIntensity[lightIndex], otherProperties.AdditionalSunIntensity[lightIndex], interpolator); result.AdditionalSunDiffuse[lightIndex] = Color.Lerp(AdditionalSunDiffuse[lightIndex], otherProperties.AdditionalSunDiffuse[lightIndex], interpolator); result.AdditionalSunDirection[lightIndex] = Vector2.Lerp(AdditionalSunDirection[lightIndex], otherProperties.AdditionalSunDirection[lightIndex], interpolator); } result.AmbientColor = Color.Lerp(AmbientColor, otherProperties.AmbientColor, interpolator); result.AmbientMultiplier = MathHelper.Lerp(AmbientMultiplier, otherProperties.AmbientMultiplier, interpolator); result.EnvironmentAmbientIntensity = MathHelper.Lerp(EnvironmentAmbientIntensity, otherProperties.EnvironmentAmbientIntensity, interpolator); result.SunSizeMultiplier = MathHelper.Lerp(SunSizeMultiplier, otherProperties.SunSizeMultiplier, interpolator); result.BackgroundColor = Color.Lerp(BackgroundColor, otherProperties.BackgroundColor, interpolator); if (result.SunDirectionNormalized.Dot(otherProperties.SunDirectionNormalized) > 0.0001f) { result.SunDirectionNormalized = Vector3.Lerp(SunDirectionNormalized, otherProperties.SunDirectionNormalized, interpolator); } else { result.SunDirectionNormalized = SunDirectionNormalized; } return(result); }