Ejemplo n.º 1
0
 /// <summary>
 /// Construct an EditMesh from a given Mesh. Call this only if you hold the monitor on
 /// the mesh or can otherwise ensure mutual exclusion
 ///
 /// The EditMesh is independent and retains no reference to the original
 /// data, use ApplyToMesh() to propagate changes back.
 /// </summary>
 /// <param name="mesh"></param>
 public EditMesh(Mesh mesh)
 {
     Faces    = new List <EditFace>(mesh.FaceCount);
     Vertices = new List <EditVertex>(mesh.FaceCount * 3);
     for (int i = 0; i < mesh.FaceCount; ++i)
     {
         var srcFace  = mesh.Faces[i];
         var destFace = new EditFace();
         for (int j = 0; j < srcFace.IndexCount; ++j)
         {
             var vert = new EditVertex(mesh, srcFace.Indices[j]);
             Vertices.Add(vert);
             destFace.AddVertex(vert);
         }
         Faces.Add(destFace);
     }
     ComputeAdjacentVertices();
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Construct an EditMesh from a given Mesh. Call this only if you hold the monitor on
 /// the mesh or can otherwise ensure mutual exclusion
 /// 
 /// The EditMesh is independent and retains no reference to the original
 /// data, use ApplyToMesh() to propagate changes back.
 /// </summary>
 /// <param name="mesh"></param>
 public EditMesh(Mesh mesh)
 {
     Faces = new List<EditFace>(mesh.FaceCount);
     Vertices = new List<EditVertex>(mesh.FaceCount * 3);
     for (int i = 0; i < mesh.FaceCount; ++i)
     {
         var srcFace = mesh.Faces[i];
         var destFace = new EditFace();
         for (int j = 0; j < srcFace.IndexCount; ++j)
         {
             var vert = new EditVertex(mesh, srcFace.Indices[j]);
             Vertices.Add(vert);
             destFace.AddVertex(vert);
         }
         Faces.Add(destFace);
     }
     ComputeAdjacentVertices();
 }