예제 #1
0
 /// <summary>
 /// Check if a vertex can be merged with another vertex.
 ///
 /// This is *not* Equals(). We want default Equals()/GetHashCode() behaviour
 /// to keep EditVertex instances distinct in dictionaries and hash sets.
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public bool CanBeMergedWith(EditVertex other)
 {
     return((Position - other.Position).LengthSquared() < MergeVectorEpsilon &&
            AreNullableVectorsApproxEqual(Normal, other.Normal) &&
            AreNullableVectorsApproxEqual(Tangent, other.Tangent) &&
            AreNullableVectorsApproxEqual(Bitangent, other.Bitangent) &&
            TexCoord.Zip(other.TexCoord, AreNullableVectorsApproxEqual).All(_ => _) &&
            Color.Zip(other.Color, AreNullableColorsApproxEqual).All(_ => _));
 }
예제 #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();
 }
예제 #3
0
 public void AddVertex(EditVertex vertex)
 {
     Vertices.Add(vertex);
     vertex.Face = this;
 }
예제 #4
0
 public bool IsApproximatelySamePosition(EditVertex other)
 {
     return((Position - other.Position).LengthSquared() < MergeVectorEpsilon);
 }
예제 #5
0
파일: EditMesh.cs 프로젝트: Kolky/open3mod
 /// <summary>
 /// Check if a vertex can be merged with another vertex.
 /// 
 /// This is *not* Equals(). We want default Equals()/GetHashCode() behaviour
 /// to keep EditVertex instances distinct in dictionaries and hash sets.
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public bool CanBeMergedWith(EditVertex other)
 {
     return (Position - other.Position).LengthSquared() < MergeVectorEpsilon &&
            AreNullableVectorsApproxEqual(Normal, other.Normal) &&
            AreNullableVectorsApproxEqual(Tangent, other.Tangent) &&
            AreNullableVectorsApproxEqual(Bitangent, other.Bitangent) &&
            TexCoord.Zip(other.TexCoord, AreNullableVectorsApproxEqual).All(_ => _) &&
            Color.Zip(other.Color, AreNullableColorsApproxEqual).All(_ => _);
 }
예제 #6
0
파일: EditMesh.cs 프로젝트: Kolky/open3mod
 /// <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();
 }
예제 #7
0
파일: EditMesh.cs 프로젝트: Kolky/open3mod
 public void AddVertex(EditVertex vertex)
 {
     Vertices.Add(vertex);
     vertex.Face = this;
 }
예제 #8
0
파일: EditMesh.cs 프로젝트: Kolky/open3mod
 public bool IsApproximatelySamePosition(EditVertex other)
 {
     return (Position - other.Position).LengthSquared() < MergeVectorEpsilon;
 }