internal void writeCacheFile() { ShaderCacheObject cacheObject = new ShaderCacheObject(); cacheObject.shaders = new List <Shader> { }; cacheObject.snippets = new List <Snippet> { }; foreach (var shader in shaders) { shader.cache(ref cacheObject); } foreach (var snippet in snippets) { snippet.cache(ref cacheObject); } string filename = Settings.Instance.game.shaderCacheFile; FileStream fileStream = new FileStream(filename, FileMode.Create, FileAccess.Write); using (fileStream) { byte[] saveAry = GenericMethods.ObjectToByteArray(cacheObject); fileStream.Write(saveAry, 0, saveAry.Length); fileStream.Close(); } }
internal void cache(ref ShaderCacheObject cacheObject) { Shader tmpShader = new Shader(); tmpShader.name = name; tmpShader.vShader = vShader; tmpShader.fShader = fShader; cacheObject.shaders.Add(tmpShader); }
internal void writeCacheFile() { ShaderCacheObject cacheObject = new ShaderCacheObject(); cacheObject.shaders = new List<Shader> { }; cacheObject.snippets = new List<Snippet> { }; foreach (var shader in shaders) { shader.cache(ref cacheObject); } foreach (var snippet in snippets) { snippet.cache(ref cacheObject); } string filename = Settings.Instance.game.shaderCacheFile; FileStream fileStream = new FileStream(filename, FileMode.Create, FileAccess.Write); using (fileStream) { byte[] saveAry = GenericMethods.ObjectToByteArray(cacheObject); fileStream.Write(saveAry, 0, saveAry.Length); fileStream.Close(); } }
internal void cache(ref ShaderCacheObject cacheObject) { cacheObject.snippets.Add(this); }