mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-11-18 22:45:59 +01:00
What the merge left out, now on this branch's own six levels: - GraphicsRules, which say what a renderer or an anti-aliasing mode rules out, and the notes that show it - the settings split into Graphics and Effects tabs - the DLSS library check beside the exe - eu07.ini import and export - one list of renderers: the backend follows from the renderer chosen The post-processing part of the levels is gone, as three switches cannot tell six levels apart. Bloom goes with the whole level. Still a transitional variant. The old renderers, their keys and their rows stay on the page, as the exe a player runs may be an old one or may have no Vulkan. That branch's five-level list and its removal of the old renderers stay out.
154 lines
6.7 KiB
C#
154 lines
6.7 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Globalization;
|
||
using StarterNG.Domain.Settings;
|
||
|
||
namespace StarterNG.Views;
|
||
|
||
/// <summary>The captions of the settings' rows and the words for their values.</summary>
|
||
internal static class SettingTexts
|
||
{
|
||
public static string[] QualityWords => new[]
|
||
{
|
||
App.Loc["QualityVeryLow"], App.Loc["QualityLow"], App.Loc["QualityNormal"],
|
||
App.Loc["QualityHigh"], App.Loc["QualityVeryHigh"]
|
||
};
|
||
|
||
/// <summary>The words of a slider that goes from 1 to 4, which has no middle.</summary>
|
||
public static string Fidelity(int level)
|
||
{
|
||
var q = QualityWords;
|
||
string[] four = { q[0], q[1], q[3], q[4] };
|
||
return four[Math.Clamp(level, 1, 4) - 1];
|
||
}
|
||
|
||
public static string Anisotropy(double value) => "x" + value.ToString("0.#", CultureInfo.CurrentCulture);
|
||
|
||
public static string AntiAliasing(AntiAliasingMode mode) => mode switch
|
||
{
|
||
AntiAliasingMode.Msaa2 => "MSAA x2",
|
||
AntiAliasingMode.Msaa4 => "MSAA x4",
|
||
AntiAliasingMode.Msaa8 => "MSAA x8",
|
||
AntiAliasingMode.Taa => App.Loc["AaTaa"],
|
||
AntiAliasingMode.Dlss => App.Loc["AaDlss"],
|
||
AntiAliasingMode.Dlaa => App.Loc["AaDlaa"],
|
||
_ => App.Loc["MsaaNone"]
|
||
};
|
||
|
||
private static string Level(int level) => App.Loc[level switch
|
||
{
|
||
1 => "LevelLow",
|
||
2 => "LevelMedium",
|
||
3 => "LevelHigh",
|
||
4 => "LevelUltra",
|
||
_ => "LevelOff"
|
||
}];
|
||
|
||
public static string TwoDecimals(double value) => value.ToString("0.00", CultureInfo.CurrentCulture);
|
||
|
||
public static string ShadowMapWord(int pixels) => pixels switch
|
||
{
|
||
<= 512 => App.Loc["QualityVeryLow"],
|
||
<= 1024 => App.Loc["QualityLow"],
|
||
<= 2048 => App.Loc["QualityModerate"],
|
||
<= 4096 => App.Loc["QualityHigh"],
|
||
_ => App.Loc["QualityVeryHigh"]
|
||
};
|
||
|
||
public static string ShadowRangeWord(int metres) => metres switch
|
||
{
|
||
<= 100 => App.Loc["RangeLow"],
|
||
<= 150 => App.Loc["RangeModerate"],
|
||
<= 250 => App.Loc["RangeHigh"],
|
||
_ => App.Loc["RangeVeryHigh"]
|
||
};
|
||
|
||
public static string CabShadowRangeWord(int metres) => metres switch
|
||
{
|
||
<= 10 => App.Loc["RangeVeryLow"],
|
||
<= 20 => App.Loc["RangeLow"],
|
||
<= 30 => App.Loc["RangeStandard"],
|
||
<= 50 => App.Loc["RangeHigh"],
|
||
_ => App.Loc["RangeVeryHigh"]
|
||
};
|
||
|
||
/// <summary>A rate below one a second reads better as the time between updates.</summary>
|
||
public static string ReflectionsInterval(double perSecond)
|
||
{
|
||
if (perSecond >= 1)
|
||
return string.Format(App.Loc["TimesPerSecond"], perSecond.ToString("0.##", CultureInfo.CurrentCulture));
|
||
double seconds = 1 / perSecond;
|
||
return seconds >= 60
|
||
? string.Format(App.Loc["EveryMinutes"], (seconds / 60).ToString("0.#", CultureInfo.CurrentCulture))
|
||
: string.Format(App.Loc["EverySeconds"], seconds.ToString("0.#", CultureInfo.CurrentCulture));
|
||
}
|
||
|
||
/// <summary>What a level sets, in the words and the units of the rows it sets.</summary>
|
||
public static string PresetSummary(GraphicsPreset p)
|
||
{
|
||
var lines = new List<string>();
|
||
void Add(string label, string value) => lines.Add(App.Loc[label] + ": " + value);
|
||
string YesNo(bool on) => App.Loc[on ? "Yes" : "No"];
|
||
string Whole(double value) => value.ToString("0.#", CultureInfo.CurrentCulture);
|
||
|
||
Add("MaxTexResolution", p.TextureSize + " px");
|
||
Add("MaxTexCabResolution", p.CabTextureSize + " px");
|
||
Add("TexFilteringQuality", Anisotropy(p.Anisotropy));
|
||
Add("AntiAliasing", AntiAliasing(p.AntiAliasing));
|
||
Add("DynamicLights", p.DynamicLights.ToString(CultureInfo.CurrentCulture));
|
||
Add("SmokeParticlesMultiplier", Fidelity(p.SmokeFidelity));
|
||
Add("RenderShadows", YesNo(p.Shadows));
|
||
if (p.Shadows)
|
||
{
|
||
Add("ShadowsResolution", p.ShadowMap + " px");
|
||
Add("ShaderRange", SimulatorSettings.ShadowReach(p.ShadowRange, p.ShadowMap, legacyRenderer: false) + " m");
|
||
Add("ShadowDisplay", App.Loc[p.ShadowRank switch { 1 => "CSROnlyImportant", 2 => "CSRLimited", _ => "CSRAll" }]);
|
||
}
|
||
Add("ReflectionsCubeMap", YesNo(p.EnvMap));
|
||
if (p.EnvMap)
|
||
{
|
||
Add("ReflectionsDetails", App.Loc[p.ReflectionsFidelity switch { 0 => "RDTerrain", 1 => "RDTerrainModels", _ => "RDTerrainModelsVehicles" }]);
|
||
Add("ReflectionsFramerate", ReflectionsInterval(p.ReflectionsRate));
|
||
}
|
||
Add("AdditionalShadersEffects", YesNo(p.ExtraEffects));
|
||
Add("TrackCurvesQuality", Fidelity(p.SplineFidelity));
|
||
Add("Ini.basedrawrange", Whole(p.DrawRange) + " m");
|
||
Add("Ini.heightbase", "×" + p.DistanceFactor.ToString("0.##", CultureInfo.CurrentCulture));
|
||
Add("BufforResolution", p.BufferScale + "%");
|
||
Add("Ini." + GraphicsPreset.SleeperKey, Whole(p.SleeperDistance) + " m");
|
||
Add("RenderRange", "×" + Whole(p.DrawRangeFactor));
|
||
Add("Ini." + GraphicsPreset.ReflectedInstancesKey, Whole(p.ReflectedInstances) + " m");
|
||
Add("Ini." + GraphicsPreset.ReflectedVehiclesKey, Whole(p.ReflectedVehicles) + " m");
|
||
|
||
var renderer = p.NewRenderer;
|
||
Add("LightShadows", Level(renderer.LampShadows));
|
||
Add("ContactShadows", Level(renderer.ContactShadows));
|
||
Add("AmbientOcclusion", renderer.Occlusion switch { 1 => "SSAO", 2 => "GTAO", _ => App.Loc["LevelOff"] });
|
||
Add("CabProbe", Level(renderer.CabProbe));
|
||
Add("Ssr", Level(renderer.ScreenReflections));
|
||
Add("RayTracing", YesNo(renderer.RayTracing));
|
||
Add("VolumetricFog", renderer.VolumetricFog ? Level(renderer.FogQuality) : App.Loc["No"]);
|
||
Add("Clouds", Level(renderer.Clouds));
|
||
Add("Grass", renderer.Grass ? renderer.GrassDistance + " m" : App.Loc["No"]);
|
||
Add("Bloom", YesNo(renderer.Bloom));
|
||
|
||
if (p.Extras is { } extras)
|
||
{
|
||
Add("MotionBlur", YesNo(extras.MotionBlur));
|
||
Add("ChromaticAberration", YesNo(extras.ChromaticAberration));
|
||
Add("SmokeDisplay", YesNo(extras.Smoke));
|
||
Add("PyScreenPriority", App.Loc[extras.PythonUpdateMs <= 200 ? "PyPriorityNormal" : "PyPriorityLowest"]);
|
||
}
|
||
if (p.Top is { } top)
|
||
{
|
||
lines.Insert(0, App.Loc["PresetUltraNote"]);
|
||
Add("ShadowAngleLimit", TwoDecimals(top.ShadowAngleLimit));
|
||
Add("Ini." + GraphicsTop.TargetFpsKey, YesNo(top.TargetFps > 0));
|
||
Add("Ini." + GraphicsTop.TextureReleaseKey, YesNo(top.TextureRelease > 0));
|
||
Add("CompressTextures", YesNo(top.CompressTextures));
|
||
Add("IgnoreIrrelevantTrains", YesNo(top.SkipDecor));
|
||
}
|
||
return string.Join("\n", lines);
|
||
}
|
||
}
|