示例#1
0
        public MeshSection(StreamReader sr, string name)
        {
            this.name = name;
            vtxList   = new VertexList(sr);
            meshList  = new MeshList(sr, vtxList);

            // 他の何かがある場合
            // 閉じるまで繰り返し
            string read = sr.ReadLine();

            while (!Regex.IsMatch(read, "}"))
            {
                if (Regex.IsMatch(read, "MeshMaterialList"))
                {
                    matList = new MeshMaterialList(sr);
                }
                else if (Regex.IsMatch(read, "MeshNormals"))
                {
                    normList = new MeshNormalList(sr);
                }
                else if (Regex.IsMatch(read, "MeshTextureCoords"))
                {
                    uvList = new MeshTextureCoordList(sr);
                }
                read = sr.ReadLine();
            }
        }
示例#2
0
        public MeshList(StreamReader s, VertexList l)
        {
            meshCount = Converter.ToInt(s);
            Console.WriteLine("MeshList.Length: " + meshCount);

            // 頂点インデックスの保存
            mesh = new List <int[]>();
            for (int i = 0; i < meshCount; i++)
            {
                // インデックスの抽出
                string[] str = s.ReadLine().Split(';');
                mesh.Add(new int[Convert.ToInt32(str[0])]);

                // 数値の抽出
                str = str[1].Split(',');
                for (int j = 0; j < mesh[i].Length; j++)
                {
                    try
                    {
                        mesh[i][j] = Convert.ToInt32(str[j]);
                    }
                    catch
                    {
                        Console.WriteLine("Invalid MeshList: " + i);
                    }
                }
            }
        }