示例#1
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;
                }
            }
        }
示例#2
0
        internal bool parse(TextReader tr)
        {
            int depth = 0;

            while (true)
            {
                if (depth < 0)
                {
                    return(false);
                }

                string str = tr.ReadLine().Trim();
                if (str.EndsWith("{")) // ライト設定などは読み飛ばす
                {
                    depth++;
                }
                else if (str.EndsWith("}"))
                {
                    if (depth > 0)
                    {
                        depth--;
                    }
                    else
                    {
                        return(true);
                    }
                }
                else if (depth == 0) // depth=0 の属性値だけ読み込む
                {
                    MQOAttribute ma = MQOAttribute.parse(str);
                    if (ma != null)
                    {
                        Attribute.Add(ma);
                    }
                }
                else
                {
                }
            }
        }