Exemplo n.º 1
0
        public static Va3cContainer ToVa3c(this VimScene vim)
        {
            var r = new Va3cContainer();

            r.geometries   = vim.Geometries.Select(ToGeometry).ToList();
            r.obj.children = vim.VimNodes.Select(ToObject).ToList();
            return(r);
        }
Exemplo n.º 2
0
        public static VimScene ToVim(this Va3cContainer va3c)
        {
            var db             = new DocumentBuilder();
            var geometryLookup = new Dictionary <string, int>();

            foreach (var g in va3c.geometries)
            {
                geometryLookup.Add(g.uuid, geometryLookup.Count);
            }
            db.AddGeometries(va3c.geometries.Select(ToGeometryBuilder));
            ProcessNode(db, va3c.obj, geometryLookup);
            return(new VimScene(db.ToDocument()));
        }
Exemplo n.º 3
0
        public static void SaveAsVim(this Va3cContainer va3c, string filePath)
        {
            var db             = new DocumentBuilder();
            var geometryLookup = new Dictionary <string, int>();

            foreach (var g in va3c.geometries)
            {
                if (g != null && g.data.vertices.Count > 0 && g.data.faces.Count > 0)
                {
                    geometryLookup.Add(g.uuid, geometryLookup.Count);
                }
            }
            db.AddGeometries(va3c.geometries.Select(ToGeometryBuilder));
            ProcessNode(db, va3c.obj, geometryLookup);
            Serializer.Serialize(db.ToDocument(), filePath);
        }
Exemplo n.º 4
0
 public static void Write(this Va3cContainer va3c, string filePath)
 {
     using (var file = File.CreateText(filePath))
         new JsonSerializer().Serialize(file, va3c);
 }
Exemplo n.º 5
0
 public static void SaveAsVim(this Va3cContainer va3c, string filePath)
 => va3c.ToVim().Save(filePath);