Changeset 2231


Ignore:
Timestamp:
Jan 17, 2013, 11:50:15 PM (7 years ago)
Author:
touky
Message:

Tweak to prevent tri_to_process.Last().m1 emptying.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/easymesh/csgbsp.cpp

    r2229 r2231  
    310310                if (i == m_tree[leaf_idx].m_tri_list.Count())
    311311                {
    312                     tri_to_process.Last().m1.Pop();
    313 
    314                     //Register the triangle as needing to intersect with Front & back leaves.
    315                     if (m_tree[leaf_idx].m_leaves[LEAF_FRONT] != LEAF_CURRENT)
    316                         tri_to_process.Last().m1.Push(m_tree[leaf_idx].m_leaves[LEAF_FRONT]);
    317                     if (m_tree[leaf_idx].m_leaves[LEAF_BACK] != LEAF_CURRENT)
    318                         tri_to_process.Last().m1.Push(m_tree[leaf_idx].m_leaves[LEAF_BACK]);
    319                     //Mark the triangle as needing point by point test
    320                     tri_to_process.Last().m5 = 1;
     312                    if (m_tree[leaf_idx].m_leaves[LEAF_FRONT] == LEAF_CURRENT &&
     313                        m_tree[leaf_idx].m_leaves[LEAF_BACK] == LEAF_CURRENT &&
     314                        tri_to_process.Last().m1.Count() == 1)
     315                    {
     316                        tri_list.Push(LEAF_CURRENT, tri_to_process.Last().m2, tri_to_process.Last().m3, tri_to_process.Last().m4);
     317                        tri_to_process.Pop();
     318                    }
     319                    else
     320                    {
     321                        tri_to_process.Last().m1.Pop();
     322
     323                        //Register the triangle as needing to intersect with Front & back leaves.
     324                        if (m_tree[leaf_idx].m_leaves[LEAF_FRONT] != LEAF_CURRENT)
     325                            tri_to_process.Last().m1.Push(m_tree[leaf_idx].m_leaves[LEAF_FRONT]);
     326                        if (m_tree[leaf_idx].m_leaves[LEAF_BACK] != LEAF_CURRENT)
     327                            tri_to_process.Last().m1.Push(m_tree[leaf_idx].m_leaves[LEAF_BACK]);
     328                        //Mark the triangle as needing point by point test
     329
     330                        tri_to_process.Last().m5 = 1;
     331                    }
    321332                }
    322333                //there was an intersection, so let's split the triangle.
Note: See TracChangeset for help on using the changeset viewer.