Skip to content

Commit

Permalink
Saturation separate for Aircraft/Cockpit
Browse files Browse the repository at this point in the history
  • Loading branch information
LB767 committed Mar 22, 2018
1 parent 0d82121 commit b3a8f1f
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions OpenShade/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1202,7 +1202,15 @@ private void ApplyPreset(object sender, RoutedEventArgs e)
#endif
{finalText}");

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");
generalText = generalText.AddBefore(ref success, "// Apply IR if active", $@"if ((cb_mObjectType == (uint)0) || (cb_mObjectType == (uint)19))
{{
#if defined(PS_NEEDS_TANSPACE)
cColor.rgb = saturate(lerp(dot(cColor.rgb, float3(0.299f, 0.587f, 0.114f)), cColor.rgb, {tweak.parameters[4].value}));
#else
cColor.rgb = saturate(lerp(dot(cColor.rgb, float3(0.299f, 0.587f, 0.114f)), cColor.rgb, 1));
#endif
}}
");

break;
}
Expand Down Expand Up @@ -1251,6 +1259,8 @@ private void ApplyPreset(object sender, RoutedEventArgs e)
Tweak aircraft = tweaks.First(p => p.name == "Aircraft lighting and saturation");
if (aircraft.isEnabled) {
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);");

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}));");
}
else {
// 1st - VC/interior
Expand All @@ -1266,7 +1276,16 @@ private void ApplyPreset(object sender, RoutedEventArgs e)
#endif
{finalText}");

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");
generalText = generalText.AddBefore(ref success, "// Apply IR if active", $@"if ((cb_mObjectType == (uint)0) || (cb_mObjectType == (uint)19))
{{
#if !defined(PS_NEEDS_TANSPACE)
cColor.rgb = saturate(lerp(dot(cColor.rgb, float3(0.299f, 0.587f, 0.114f)), cColor.rgb, {tweak.parameters[4].value}));
#else
cColor.rgb = saturate(lerp(dot(cColor.rgb, float3(0.299f, 0.587f, 0.114f)), cColor.rgb, 1));
#endif
}}
");

}

break;
Expand Down

0 comments on commit b3a8f1f

Please sign in to comment.