[DEV] update new etk Uri API
This commit is contained in:
parent
42f5d84744
commit
640d3fdcbe
@ -107,6 +107,16 @@ void BroadPhaseAlgorithm::updateProxyCollisionShape(ProxyShape* _proxyShape,
|
||||
}
|
||||
}
|
||||
|
||||
static bool sortFunction(const etk::Pair<int32_t,int32_t>& _pair1, const etk::Pair<int32_t,int32_t>& _pair2) {
|
||||
if (_pair1.first < _pair2.first) {
|
||||
return true;
|
||||
}
|
||||
if (_pair1.first == _pair2.first) {
|
||||
return _pair1.second < _pair2.second;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void BroadPhaseAlgorithm::computeOverlappingPairs() {
|
||||
m_potentialPairs.clear();
|
||||
// For all collision shapes that have moved (or have been created) during the
|
||||
@ -133,17 +143,7 @@ void BroadPhaseAlgorithm::computeOverlappingPairs() {
|
||||
// Reset the array of collision shapes that have move (or have been created) during the last simulation step
|
||||
m_movedShapes.clear();
|
||||
// Sort the array of potential overlapping pairs in order to remove duplicate pairs
|
||||
m_potentialPairs.sort(0,
|
||||
m_potentialPairs.size()-1,
|
||||
[](const etk::Pair<int32_t,int32_t>& _pair1, const etk::Pair<int32_t,int32_t>& _pair2) {
|
||||
if (_pair1.first < _pair2.first) {
|
||||
return true;
|
||||
}
|
||||
if (_pair1.first == _pair2.first) {
|
||||
return _pair1.second < _pair2.second;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
etk::algorithm::quickSort(m_potentialPairs, sortFunction);
|
||||
// Check all the potential overlapping pairs avoiding duplicates to report unique
|
||||
// overlapping pairs
|
||||
uint32_t iii=0;
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <ephysics/collision/narrowphase/ConcaveVsConvexAlgorithm.hpp>
|
||||
#include <ephysics/collision/CollisionDetection.hpp>
|
||||
#include <ephysics/engine/CollisionWorld.hpp>
|
||||
#include <etk/algorithm.hpp>
|
||||
|
||||
using namespace ephysics;
|
||||
|
||||
@ -91,17 +92,17 @@ void ConvexVsTriangleCallback::testTriangle(const vec3* _trianglePoints) {
|
||||
algo->testCollision(shapeConvexInfo, shapeConcaveInfo, m_narrowPhaseCallback);
|
||||
}
|
||||
|
||||
static bool sortFunction(const SmoothMeshContactInfo& _contact1, const SmoothMeshContactInfo& _contact2) {
|
||||
return _contact1.contactInfo.penetrationDepth <= _contact2.contactInfo.penetrationDepth;
|
||||
}
|
||||
|
||||
void ConcaveVsConvexAlgorithm::processSmoothMeshCollision(OverlappingPair* _overlappingPair,
|
||||
etk::Vector<SmoothMeshContactInfo> _contactPoints,
|
||||
NarrowPhaseCallback* _callback) {
|
||||
// Set with the triangle vertices already processed to void further contacts with same triangle
|
||||
etk::Vector<etk::Pair<int32_t, vec3>> processTriangleVertices;
|
||||
// Sort the list of narrow-phase contacts according to their penetration depth
|
||||
_contactPoints.sort(0,
|
||||
_contactPoints.size()-1,
|
||||
[](const SmoothMeshContactInfo& _contact1, const SmoothMeshContactInfo& _contact2) {
|
||||
return _contact1.contactInfo.penetrationDepth < _contact2.contactInfo.penetrationDepth;
|
||||
});
|
||||
etk::algorithm::quickSort(_contactPoints, sortFunction);
|
||||
// For each contact point (from smaller penetration depth to larger)
|
||||
etk::Vector<SmoothMeshContactInfo>::Iterator it;
|
||||
for (it = _contactPoints.begin(); it != _contactPoints.end(); ++it) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user