public static ShaderDefinition GetShaderDefinition(string name) { if (!Cache.TryGetValue(name, out var result)) { var vertJson = ReadJson(name, "vert"); var fragJson = ReadJson(name, "frag"); result = ShaderDefinition.FromJson(vertJson, fragJson); Cache.Add(name, result); } return(result); }
public static ShaderDefinition GetShaderDefinition(string name) { if (!Cache.TryGetValue(name, out var result)) { using (var jsonStream = Assembly.GetExecutingAssembly().GetManifestResourceStream($"OpenSage.Graphics.Shaders.Config.{name}.json")) using (var jsonStreamReader = new StreamReader(jsonStream)) { result = ShaderDefinition.FromJson(jsonStreamReader.ReadToEnd()); } Cache.Add(name, result); } return(result); }