Esempio n. 1
0
 public void AddTristrip(Tristrip t)
 {
     Tristrips.Add(t);
     foreach (Facepoint f in t.points)
     {
         nodeIds.Add(f.NodeId);
     }
     t.grouped = true;
 }
Esempio n. 2
0
        public Tristrip CanAdd(Tristrip t)
        {
            HashSet <int> tempIds  = new HashSet <int>();
            Tristrip      notAdded = new Tristrip();
            Tristrip      added    = new Tristrip();
            int           range    = 0;

            foreach (int x in nodeIds)
            {
                tempIds.Add(x);
            }

            foreach (Facepoint f in t.points)
            {
                tempIds.Add(f.NodeId);
                range++;
                if (tempIds.Count <= 10)
                {
                    continue;
                }
                else
                {
                    goto Next;
                }
            }
Next:
            //Align to range divisible by 3
            int remainder = 0;

            if ((remainder = range % 3) != 0)
            {
                range -= remainder;
            }

            if (range < 3)
            {
                return(null);
            }

            //Seperate tristrip
            for (int i = 0; i < t.points.Count; i++)
            {
                if (i <= range)
                {
                    added.points.Add(t.points[i]);
                }
                else
                {
                    notAdded.points.Add(t.points[i]);
                }
            }

            if (added.points.Count >= 3)
            {
                AddTristrip(added);
            }

            if (notAdded.points.Count >= 3)
            {
                return(notAdded);
            }

            return(null);
        }