Beispiel #1
0
        public void BuildIndexBuffer(EditableMesh mesh)
        {
            var curFaces = new List <int>();

            for (var i = 0; i < Faces.Count; i++)
            {
                var f = mesh.GetFace(Faces[i]);
                if (f.Deleted)
                {
                    continue;
                }
                curFaces.Add(Faces[i]);
            }

            Faces = curFaces;

            FaceLods.Add(curFaces);

            var desc = new CDrawPrimitiveDesc();

            desc.SetDefault();
            desc.StartIndex    = 0;
            desc.NumPrimitives = (UInt32)Faces.Count;

            Lods.Clear();
            Lods.Add(desc);

            System.Diagnostics.Debug.WriteLine($"Face({Mtl}) = {desc.NumPrimitives}");
        }
Beispiel #2
0
 public void BuildIndexBuffer(EditableMesh mesh, List <int> indices)
 {
     for (int i = 0; i < Faces.Count; i++)
     {
         var f = mesh.Faces[Faces[i]];
         indices.Add(f.A);
         indices.Add(f.B);
         indices.Add(f.C);
     }
 }
Beispiel #3
0
        public int GetDeletedFaceNum(EditableMesh mesh)
        {
            int num = 0;

            for (int i = 0; i < Faces.Count; i++)
            {
                if (mesh.Faces[Faces[i]].Deleted)
                {
                    num++;
                }
                else
                {
                    break;
                }
            }
            return(num);
        }
Beispiel #4
0
        public void FaceDeleted(EditableMesh mesh, int face)
        {
            int fIdx = -1;

            for (int i = 0; i < Faces.Count; i++)
            {
                if (Faces[i] == face)
                {
                    fIdx = i;
                    break;
                }
            }
            if (fIdx < 0)
            {
                return;
            }
            int num = 0;

            for (int i = 0; i < Faces.Count; i++)
            {
                if (mesh.Faces[Faces[i]].Deleted)
                {
                    num++;
                }
                else
                {
                    break;
                }
            }
            //if(num== TestFace)
            //{
            //    int xxx = 0;
            //}
            //最后一个面被删除的情况
            if (num == Faces.Count)
            {
                return;
            }
            var save = Faces[num];

            Faces[num]  = Faces[fIdx];
            Faces[fIdx] = save;
        }
Beispiel #5
0
 public void BuildIndexBuffer(EditableMesh mesh, List <UInt16> indices)
 {
     if (FinalFaces.Count > 0)
     {
         for (int i = 0; i < FinalFaces.Count; i++)
         {
             var f = mesh.Faces[FinalFaces[i]];
             indices.Add((UInt16)f.A);
             indices.Add((UInt16)f.B);
             indices.Add((UInt16)f.C);
         }
     }
     else
     {
         for (int i = 0; i < Faces.Count; i++)
         {
             var f = mesh.Faces[Faces[i]];
             indices.Add((UInt16)f.A);
             indices.Add((UInt16)f.B);
             indices.Add((UInt16)f.C);
         }
     }
 }