Skip to content

Commit b3a8f1f

Browse files
committed
Saturation separate for Aircraft/Cockpit
1 parent 0d82121 commit b3a8f1f

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

OpenShade/MainWindow.xaml.cs

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,7 +1202,15 @@ private void ApplyPreset(object sender, RoutedEventArgs e)
12021202
#endif
12031203
{finalText}");
12041204

1205-
generalText = generalText.AddBefore(ref success, "// Apply IR if active", "if ((cb_mObjectType == (uint)0) || (cb_mObjectType == (uint)19))\r\n {\r\n cColor.rgb = saturate(lerp(dot(cColor.rgb, float3(0.299f, 0.587f, 0.114f)), cColor.rgb, " + tweak.parameters[4].value.ToString() + "));\r\n }\r\n");
1205+
generalText = generalText.AddBefore(ref success, "// Apply IR if active", $@"if ((cb_mObjectType == (uint)0) || (cb_mObjectType == (uint)19))
1206+
{{
1207+
#if defined(PS_NEEDS_TANSPACE)
1208+
cColor.rgb = saturate(lerp(dot(cColor.rgb, float3(0.299f, 0.587f, 0.114f)), cColor.rgb, {tweak.parameters[4].value}));
1209+
#else
1210+
cColor.rgb = saturate(lerp(dot(cColor.rgb, float3(0.299f, 0.587f, 0.114f)), cColor.rgb, 1));
1211+
#endif
1212+
}}
1213+
");
12061214

12071215
break;
12081216
}
@@ -1251,6 +1259,8 @@ private void ApplyPreset(object sender, RoutedEventArgs e)
12511259
Tweak aircraft = tweaks.First(p => p.name == "Aircraft lighting and saturation");
12521260
if (aircraft.isEnabled) {
12531261
generalText = generalText.ReplaceFirst(ref success, replaceText, $"DirectionalLightingTweak(vNormalWS, shadowContrib, { tweak.parameters[0].value}, { tweak.parameters[1].value}, { tweak.parameters[2].value}, { tweak.parameters[3].value}, directionalDiffuse);");
1262+
1263+
generalText = generalText.ReplaceFirst(ref success, "cColor.rgb = saturate(lerp(dot(cColor.rgb, float3(0.299f, 0.587f, 0.114f)), cColor.rgb, 1));", $"cColor.rgb = saturate(lerp(dot(cColor.rgb, float3(0.299f, 0.587f, 0.114f)), cColor.rgb, {tweak.parameters[4].value}));");
12541264
}
12551265
else {
12561266
// 1st - VC/interior
@@ -1266,7 +1276,16 @@ private void ApplyPreset(object sender, RoutedEventArgs e)
12661276
#endif
12671277
{finalText}");
12681278

1269-
generalText = generalText.AddBefore(ref success, "// Apply IR if active", "if ((cb_mObjectType == (uint)0) || (cb_mObjectType == (uint)19))\r\n {\r\n cColor.rgb = saturate(lerp(dot(cColor.rgb, float3(0.299f, 0.587f, 0.114f)), cColor.rgb, " + tweak.parameters[4].value.ToString() + "));\r\n }\r\n");
1279+
generalText = generalText.AddBefore(ref success, "// Apply IR if active", $@"if ((cb_mObjectType == (uint)0) || (cb_mObjectType == (uint)19))
1280+
{{
1281+
#if !defined(PS_NEEDS_TANSPACE)
1282+
cColor.rgb = saturate(lerp(dot(cColor.rgb, float3(0.299f, 0.587f, 0.114f)), cColor.rgb, {tweak.parameters[4].value}));
1283+
#else
1284+
cColor.rgb = saturate(lerp(dot(cColor.rgb, float3(0.299f, 0.587f, 0.114f)), cColor.rgb, 1));
1285+
#endif
1286+
}}
1287+
");
1288+
12701289
}
12711290

12721291
break;

0 commit comments

Comments
 (0)