void SimpleBroadphase::DestroyProxy(BroadphaseProxy* proxyOrg) { int i; SimpleBroadphaseProxy* proxy0 = static_cast<SimpleBroadphaseProxy*>(proxyOrg); SimpleBroadphaseProxy* proxy1 = &m_proxies[0]; int index = proxy0 - proxy1; assert (index < m_maxProxies); m_freeProxies[--m_firstFreeProxy] = index; RemoveOverlappingPairsContainingProxy(proxyOrg); for (i=0;i<m_numProxies;i++) { if (m_pProxies[i] == proxyOrg) { m_pProxies[i] = m_pProxies[m_numProxies-1]; break; } } m_numProxies--; //validate(); }
void AxisSweep3::RemoveHandle(unsigned short handle) { Handle* pHandle = GetHandle(handle); RemoveOverlappingPairsContainingProxy(pHandle); // compute current limit of edge arrays int limit = m_numHandles * 2; int axis; for (axis = 0;axis<3;axis++) { Edge* pEdges = m_pEdges[axis]; int maxEdge= pHandle->m_maxEdges[axis]; pEdges[maxEdge].m_pos = 0xffff; int minEdge = pHandle->m_minEdges[axis]; pEdges[minEdge].m_pos = 0xffff; } // remove the edges by sorting them up to the end of the list for ( axis = 0; axis < 3; axis++) { Edge* pEdges = m_pEdges[axis]; int max = pHandle->m_maxEdges[axis]; pEdges[max].m_pos = 0xffff; SortMaxUp(axis,max,false); int i = pHandle->m_minEdges[axis]; pEdges[i].m_pos = 0xffff; SortMinUp(axis,i,false); pEdges[limit-1].m_handle = 0; pEdges[limit-1].m_pos = 0xffff; } // free the handle FreeHandle(handle); }