示例#1
0
        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);
        }
示例#2
0
 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);
 }