Beispiel #1
0
 public static ModelRoot LoadGltf2(string zipPath, ReadSettings settings = null)
 {
     using (var zip = new ZipReader(zipPath))
     {
         return(zip.LoadGltf2(settings));
     }
 }
Beispiel #2
0
        private static Schema2.ModelRoot _ZipRoundtrip(Schema2.ModelRoot model)
        {
            byte[] raw;

            // write to zip into memory:

            using (var memory = new System.IO.MemoryStream())
            {
                using (var zipWriter = new ZipWriter(memory))
                {
                    zipWriter.AddModel("model.gltf", model);
                }

                raw = memory.ToArray();
            }

            // read the model back:

            using (var memory = new System.IO.MemoryStream(raw, false))
            {
                using (var zipReader = new ZipReader(memory))
                {
                    return(zipReader.LoadModel("model.gltf"));
                }
            }
        }