started working on some serious performance improvements. now the union find is optimized, the broadphase add/remove overlapping pair was too slow. added a stl::set to keep track of overlapping pairs. this speeds up the set find/remove. work in progress.the SimpleBroadphase is broken. will be fixed tomorrow.

Did some tests with 3000 rigidbodies, works much smoother now :)
This commit is contained in:
ejcoumans
2006-09-19 02:59:30 +00:00
parent d47d23ea74
commit 8c023e764c
21 changed files with 242 additions and 130 deletions

View File

@@ -42,6 +42,9 @@ IMPLICIT_CONVEX_SHAPES_START_HERE,
CONCAVE_SHAPES_START_HERE,
//keep all the convex shapetype below here, for the check IsConvexShape in broadphase proxy!
TRIANGLE_MESH_SHAPE_PROXYTYPE,
///used for demo integration FAST/Swift collision library and Bullet
FAST_CONCAVE_MESH_PROXYTYPE,
EMPTY_SHAPE_PROXYTYPE,
STATIC_PLANE_PROXYTYPE,
CONCAVE_SHAPES_END_HERE,
@@ -124,17 +127,26 @@ struct BroadphasePair
}
}
BroadphasePair(BroadphaseProxy& proxy0,BroadphaseProxy& proxy1)
:
m_pProxy0(&proxy0),
m_pProxy1(&proxy1)
{
//keep them sorted, so the std::set operations work
if (&proxy0 < &proxy1)
{
m_pProxy0 = &proxy0;
m_pProxy1 = &proxy1;
}
else
{
m_pProxy0 = &proxy1;
m_pProxy1 = &proxy0;
}
for (int i=0;i<SIMPLE_MAX_ALGORITHMS;i++)
{
{
m_algorithms[i] = 0;
}
}
BroadphaseProxy* m_pProxy0;
BroadphaseProxy* m_pProxy1;
@@ -142,5 +154,14 @@ struct BroadphasePair
mutable CollisionAlgorithm* m_algorithms[SIMPLE_MAX_ALGORITHMS];
};
//comparison for set operation, see Solid DT_Encounter
inline bool operator<(const BroadphasePair& a, const BroadphasePair& b)
{
return a.m_pProxy0 < b.m_pProxy0 ||
(a.m_pProxy0 == b.m_pProxy0 && a.m_pProxy1 < b.m_pProxy1);
}
#endif //BROADPHASE_PROXY_H