示例#1
0
 void createIndices()
 {
     for (int x = 0; x < w - 1; x++)
     {
         for (int z = 0; z < h - 1; z++)
         {
             int upperLeft          = (z * w + x);
             int upperRight         = (upperLeft + 1);
             int lowerLeft          = (upperLeft + w);
             int lowerRight         = (lowerLeft + 1);
             SmoothMeshTriangle fmt = new SmoothMeshTriangle(upperLeft, upperRight, lowerLeft, m, Name + x + "" + z);
             box = BBox.Join(box, fmt.GetBoundingBox());
             m.AddObject(fmt);
             SmoothMeshTriangle fmt2 = new SmoothMeshTriangle(lowerLeft, upperRight, lowerRight, m, Name + x + "" + z + "2");
             box = BBox.Join(box, fmt2.GetBoundingBox());
             m.AddObject(fmt2);
         }
     }
 }
示例#2
0
 void parseFaces()
 {
     for (int i = 0; i < lines.Length; i++)
     {
         if (lines[i][0] == 'f')
         {
             string[] w = lines[i].Replace("f ", "").Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
             for (int j = 0; j < w.Length - 2; j++)
             {
                 if (hasNormals)
                 {
                     SmoothMeshTriangle fmt = new SmoothMeshTriangle(int.Parse(w[j]) - 1, int.Parse(w[j + 1]) - 1, int.Parse(w[j + 2]) - 1, ret, i + "" + j + "smsh" + "Mesh" + ret.Name);
                     ret.AddObject(fmt);
                 }
                 else
                 {
                     FlatMeshTriangle fmt = new FlatMeshTriangle(int.Parse(w[j]) - 1, int.Parse(w[j + 1]) - 1, int.Parse(w[j + 2]) - 1, ret, i + "" + j + "fmsh" + "Mesh" + ret.Name);
                     fmt.ComputeNormal(false);
                     ret.AddObject(fmt);
                 }
             }
         }
     }
 }