Exemplo n.º 1
0
 public bool sharesVerts(SATriangle obj)
 {
     if (vs[0] == obj.vs[0] ||
         vs[0] == obj.vs[1] ||
         vs[0] == obj.vs[2])
     {
         if (submeshIdx != obj.submeshIdx)
         {
             return(true);
         }
     }
     if (vs[1] == obj.vs[0] ||
         vs[1] == obj.vs[1] ||
         vs[1] == obj.vs[2])
     {
         if (submeshIdx != obj.submeshIdx)
         {
             return(true);
         }
     }
     if (vs[2] == obj.vs[0] ||
         vs[2] == obj.vs[1] ||
         vs[2] == obj.vs[2])
     {
         if (submeshIdx != obj.submeshIdx)
         {
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 2
0
            public bool isSame(object obj)
            {
                SATriangle tobj = (SATriangle)obj;

                if (vs[0] == tobj.vs[0] &&
                    vs[1] == tobj.vs[1] &&
                    vs[2] == tobj.vs[2] &&
                    submeshIdx != tobj.submeshIdx)
                {
                    return(true);
                }
                return(false);
            }
Exemplo n.º 3
0
        public static int doSubmeshesShareVertsOrTris(Mesh m)
        {
            List <SATriangle> tlist = new List <SATriangle>();
            bool sharesVerts        = false;
            bool sharesTris         = false;

            for (int i = 0; i < m.subMeshCount; i++)
            {
                int[] sm = m.GetTriangles(i);
                for (int j = 0; j < sm.Length; j += 3)
                {
                    SATriangle consider = new SATriangle(sm, j, i);
                    for (int k = 0; k < tlist.Count; k++)
                    {
                        if (consider.isSame(tlist[k]))
                        {
                            sharesTris = true;
                        }
                        if (consider.sharesVerts(tlist[k]))
                        {
                            sharesVerts = true;
                        }
                    }
                    tlist.Add(consider);
                }
            }
            if (sharesTris)
            {
                return(2);
            }
            if (sharesVerts)
            {
                return(1);
            }
            return(0);
        }