diff options
| author | Sheikh Dawood <[email protected]> | 2018-08-13 13:37:04 -0500 |
|---|---|---|
| committer | Sheikh Dawood <[email protected]> | 2018-08-13 13:37:04 -0500 |
| commit | 3f9977d72f8a481e76b6ad643a3d312a8cf9b551 (patch) | |
| tree | 8dfa563cf2a06498b56b055af133bd066f1f349c /PhysX_3.4/Source/GeomUtils/src/gjk | |
| parent | PhysX 3.4, APEX 1.4 patch release @24214033 (diff) | |
| download | physx-3.4-3f9977d72f8a481e76b6ad643a3d312a8cf9b551.tar.xz physx-3.4-3f9977d72f8a481e76b6ad643a3d312a8cf9b551.zip | |
PhysX 3.4, APEX 1.4 patch release @24698370
Diffstat (limited to 'PhysX_3.4/Source/GeomUtils/src/gjk')
| -rw-r--r-- | PhysX_3.4/Source/GeomUtils/src/gjk/GuEPA.cpp | 6 | ||||
| -rw-r--r-- | PhysX_3.4/Source/GeomUtils/src/gjk/GuEPAFacet.h | 34 |
2 files changed, 20 insertions, 20 deletions
diff --git a/PhysX_3.4/Source/GeomUtils/src/gjk/GuEPA.cpp b/PhysX_3.4/Source/GeomUtils/src/gjk/GuEPA.cpp index 5dfef1cd..066fd3ae 100644 --- a/PhysX_3.4/Source/GeomUtils/src/gjk/GuEPA.cpp +++ b/PhysX_3.4/Source/GeomUtils/src/gjk/GuEPA.cpp @@ -288,7 +288,8 @@ namespace Gu { //ML: facet isn't visible from w (we don't have a reflex edge), this facet will be on the boundary and part of the new polytope so that //we will push it into our edgeBuffer - edgeBuffer.Insert(f, index); + if(!edgeBuffer.Insert(f, index)) + return; } else { @@ -622,7 +623,8 @@ namespace Gu facet->silhouette(q, aBuf, bBuf, edgeBuffer, facetManager); - if (edgeBuffer.IsEmpty()) + //the edge buffer either empty or overflow + if (!edgeBuffer.IsValid()) { calculateContactInformation(aBuf, bBuf, facet, a, b, pa, pb, normal, penDepth, takeCoreShape); return EPA_DEGENERATE; diff --git a/PhysX_3.4/Source/GeomUtils/src/gjk/GuEPAFacet.h b/PhysX_3.4/Source/GeomUtils/src/gjk/GuEPAFacet.h index ae86fd16..1a6ffdb3 100644 --- a/PhysX_3.4/Source/GeomUtils/src/gjk/GuEPAFacet.h +++ b/PhysX_3.4/Source/GeomUtils/src/gjk/GuEPAFacet.h @@ -193,25 +193,21 @@ namespace Gu class EdgeBuffer { public: - EdgeBuffer() : m_Size(0) + EdgeBuffer() : m_Size(0), m_OverFlow(false) { } - Edge* Insert(const Edge& edge) - { - PX_ASSERT(m_Size < MaxEdges); - Edge* PX_RESTRICT pEdge = &m_pEdges[m_Size++]; - *pEdge = edge; - return pEdge; - } - Edge* Insert(Facet* PX_RESTRICT facet, const PxU32 index) { - PX_ASSERT(m_Size < MaxEdges); - Edge* pEdge = &m_pEdges[m_Size++]; - pEdge->m_facet=facet; - pEdge->m_index=index; - return pEdge; + if (m_Size < MaxEdges) + { + Edge* pEdge = &m_pEdges[m_Size++]; + pEdge->m_facet = facet; + pEdge->m_index = index; + return pEdge; + } + m_OverFlow = true; + return NULL; } Edge* Get(const PxU32 index) @@ -225,18 +221,20 @@ namespace Gu return m_Size; } - bool IsEmpty() + bool IsValid() { - return m_Size == 0; + return m_Size > 0 && !m_OverFlow; } void MakeEmpty() { m_Size = 0; + m_OverFlow = false; } - Edge m_pEdges[MaxEdges]; - PxU32 m_Size; + Edge m_pEdges[MaxEdges]; + PxU32 m_Size; + bool m_OverFlow; }; //ML: calculate MTD points for a shape pair |