示例#1
0
        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();
            }
        }
示例#2
0
        internal void cache(ref ShaderCacheObject cacheObject)
        {
            Shader tmpShader = new Shader();

            tmpShader.name    = name;
            tmpShader.vShader = vShader;
            tmpShader.fShader = fShader;

            cacheObject.shaders.Add(tmpShader);
        }
示例#3
0
        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();
            }
        }
示例#4
0
 internal void cache(ref ShaderCacheObject cacheObject)
 {
     cacheObject.snippets.Add(this);
 }
示例#5
0
        internal void cache(ref ShaderCacheObject cacheObject)
        {
            Shader tmpShader = new Shader();

            tmpShader.name = name;
            tmpShader.vShader = vShader;
            tmpShader.fShader = fShader;

            cacheObject.shaders.Add(tmpShader);
        }
示例#6
0
 internal void cache(ref ShaderCacheObject cacheObject)
 {
     cacheObject.snippets.Add(this);
 }