Ejemplo n.º 1
0
        // 默认共两条边 才算 临面
        protected static bool IsNeighbors(LODMesh lodMesh, int faceIndex1, int faceIndex2, int shareVertexCount = 2)
        {
            int count = 0;

            if (faceIndex1 != faceIndex2)
            {
                LODFace face1 = lodMesh.faces[faceIndex1];
                LODFace face2 = lodMesh.faces[faceIndex2];
                for (int i = 0; i < 3; ++i)
                {
                    if (face1.vertexIndexList.Contains(face2.vertexIndexList[i]))
                    {
                        ++count;
                        if (count == shareVertexCount)
                        {
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }
Ejemplo n.º 2
0
        protected static List <int> GetEdgeShareFaces(LODMesh mesh, int iIdx, int jIdx, List <int> remain = null)
        {
            RepeatedVertex u          = mesh.vertices[iIdx];
            RepeatedVertex v          = mesh.vertices[jIdx];
            List <int>     totalFaces = u.neighborFaces;
            List <int>     uvFaces    = new List <int>();

            for (int k = 0; k < totalFaces.Count; ++k)
            {
                LODFace face = mesh.faces[totalFaces[k]];
                if (face.ContainVertex(jIdx))
                {
                    uvFaces.Add(totalFaces[k]);
                }
                else
                {
                    if (remain != null)
                    {
                        remain.Add(totalFaces[k]); // 保留不共享边的面
                    }
                }
            }
            return(uvFaces);
        }