예제 #1
0
        public static MQOFile load(TextReader tr, bool triangle_only = false)
        {
            MQOFile mqo = new MQOFile();

            if (!mqo.parse(tr, triangle_only))
            {
                mqo.Dispose(); mqo = null;
            }
            return(mqo);
        }
예제 #2
0
        internal bool parse(TextReader tr, bool triangle_only = false)
        {
            while (true)
            {
                string str = tr.ReadLine().Trim();
                if (str.StartsWith("vertex "))
                {
                    if (!parseVertex(tr))
                    {
                        Dispose(); return(false);
                    }
                    continue;
                }
                else if (str.StartsWith("face "))
                {
                    if (!parseFace(tr, triangle_only))
                    {
                        Dispose(); return(false);
                    }

                    continue;
                }
                else if (str.EndsWith("{"))
                {
                    if (!MQOFile.skipBlock(tr))
                    {
                        Dispose(); return(false);
                    }
                    continue;
                }
                else if (str.EndsWith("}"))
                {
                    return(true);
                }
                else
                {
                    MQOAttribute ma = MQOAttribute.parse(str);
                    if (ma == null)
                    {
                        Dispose(); return(false);
                    }
                    Attribute.Add(ma);
                    continue;
                }
            }
        }
예제 #3
0
 public static MQOFile load(TextReader tr, bool triangle_only=false)
 {
     MQOFile mqo = new MQOFile();
     if (!mqo.parse(tr, triangle_only)) { mqo.Dispose(); mqo = null; }
     return mqo;
 }