mirror of
https://github.com/drewcassidy/KSP-Conformal-Decals.git
synced 2024-09-01 18:23:54 +00:00
Shader fixes and legacy shader code
This commit is contained in:
@ -6,8 +6,36 @@ namespace ConformalDecals {
|
||||
public static class DecalConfig {
|
||||
private static Texture2D _blankNormal;
|
||||
private static List<string> _shaderBlacklist;
|
||||
private static int _decalLayer = 31;
|
||||
private static bool _selectableInFlight = false;
|
||||
private static int _decalLayer = 31;
|
||||
private static bool _selectableInFlight;
|
||||
|
||||
private struct LegacyShaderEntry {
|
||||
public string name;
|
||||
public string[] keywords;
|
||||
}
|
||||
|
||||
private static readonly Dictionary<string, LegacyShaderEntry> LegacyShaderPairs = new Dictionary<string, LegacyShaderEntry>() {
|
||||
["ConformalDecals/Feature/Bumped"] = new LegacyShaderEntry() {
|
||||
name = "ConformalDecals/Decal/Standard",
|
||||
keywords = new[] {"DECAL_BUMPMAP"}
|
||||
},
|
||||
["ConformalDecals/Paint/Diffuse"] = new LegacyShaderEntry() {
|
||||
name = "ConformalDecals/Decal/Standard",
|
||||
keywords = new string[] { }
|
||||
},
|
||||
["ConformalDecals/Paint/Specular"] = new LegacyShaderEntry() {
|
||||
name = "ConformalDecals/Decal/Standard",
|
||||
keywords = new[] {"DECAL_SPECMAP"}
|
||||
},
|
||||
["ConformalDecals/Paint/DiffuseSDF"] = new LegacyShaderEntry() {
|
||||
name = "ConformalDecals/Decal/Standard",
|
||||
keywords = new[] {"DECAL_SDF_ALPHA"}
|
||||
},
|
||||
["ConformalDecals/Paint/SpecularSDF"] = new LegacyShaderEntry() {
|
||||
name = "ConformalDecals/Decal/Standard",
|
||||
keywords = new[] {"DECAL_SDF_ALPHA", "DECAL_SPECMAP"}
|
||||
},
|
||||
};
|
||||
|
||||
public static Texture2D BlankNormal => _blankNormal;
|
||||
|
||||
@ -23,6 +51,18 @@ namespace ConformalDecals {
|
||||
return _shaderBlacklist.Contains(shaderName);
|
||||
}
|
||||
|
||||
public static bool IsLegacy(string shaderName, out string newShader, out string[] keywords) {
|
||||
if (LegacyShaderPairs.TryGetValue(shaderName, out var entry)) {
|
||||
newShader = entry.name;
|
||||
keywords = entry.keywords;
|
||||
return true;
|
||||
}
|
||||
|
||||
newShader = null;
|
||||
keywords = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void ParseConfig(ConfigNode node) {
|
||||
foreach (var blacklist in node.GetNodes("SHADERBLACKLIST")) {
|
||||
foreach (var shaderName in blacklist.GetValuesList("shader")) {
|
||||
|
Reference in New Issue
Block a user