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(); } }
public void writeCacheFile() { List <Mesh> SaveList = new List <Mesh> { }; foreach (var mesh in meshes) { mesh.cacheMesh(ref SaveList); } string filename = Settings.Instance.game.modelCacheFile; FileStream fileStream = new FileStream(filename, FileMode.Create, FileAccess.Write); using (fileStream) { byte[] saveAry = GenericMethods.ObjectToByteArray(SaveList); fileStream.Write(saveAry, 0, saveAry.Length); fileStream.Close(); } }
public void writeCacheFile() { List <Template> saveList = new List <Template> { }; foreach (var template in templates) { template.cache(ref saveList); } string filename = Settings.Instance.game.templateCacheFile; FileStream fileStream = new FileStream(filename, FileMode.Create, FileAccess.Write); using (fileStream) { byte[] saveAry = GenericMethods.ObjectToByteArray(saveList); fileStream.Write(saveAry, 0, saveAry.Length); fileStream.Close(); } }