mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-27 07:15:37 +00:00
Revert "Updated SDL, Bullet and OpenAL soft libs"
This reverts commit 370161cfb1.
This commit is contained in:
parent
63be684474
commit
bc77ff0833
1102 changed files with 62741 additions and 204988 deletions
|
|
@ -15,60 +15,68 @@ subject to the following restrictions:
|
|||
|
||||
#include "btUnionFind.h"
|
||||
|
||||
|
||||
|
||||
btUnionFind::~btUnionFind()
|
||||
{
|
||||
Free();
|
||||
|
||||
}
|
||||
|
||||
btUnionFind::btUnionFind()
|
||||
{
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void btUnionFind::allocate(int N)
|
||||
void btUnionFind::allocate(int N)
|
||||
{
|
||||
m_elements.resize(N);
|
||||
}
|
||||
void btUnionFind::Free()
|
||||
void btUnionFind::Free()
|
||||
{
|
||||
m_elements.clear();
|
||||
}
|
||||
|
||||
void btUnionFind::reset(int N)
|
||||
|
||||
void btUnionFind::reset(int N)
|
||||
{
|
||||
allocate(N);
|
||||
|
||||
for (int i = 0; i < N; i++)
|
||||
{
|
||||
m_elements[i].m_id = i;
|
||||
m_elements[i].m_sz = 1;
|
||||
}
|
||||
for (int i = 0; i < N; i++)
|
||||
{
|
||||
m_elements[i].m_id = i; m_elements[i].m_sz = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class btUnionFindElementSortPredicate
|
||||
{
|
||||
public:
|
||||
bool operator()(const btElement& lhs, const btElement& rhs) const
|
||||
{
|
||||
return lhs.m_id < rhs.m_id;
|
||||
}
|
||||
public:
|
||||
|
||||
bool operator() ( const btElement& lhs, const btElement& rhs ) const
|
||||
{
|
||||
return lhs.m_id < rhs.m_id;
|
||||
}
|
||||
};
|
||||
|
||||
///this is a special operation, destroying the content of btUnionFind.
|
||||
///it sorts the elements, based on island id, in order to make it easy to iterate over islands
|
||||
void btUnionFind::sortIslands()
|
||||
void btUnionFind::sortIslands()
|
||||
{
|
||||
|
||||
//first store the original body index, and islandId
|
||||
int numElements = m_elements.size();
|
||||
|
||||
for (int i = 0; i < numElements; i++)
|
||||
|
||||
for (int i=0;i<numElements;i++)
|
||||
{
|
||||
m_elements[i].m_id = find(i);
|
||||
#ifndef STATIC_SIMULATION_ISLAND_OPTIMIZATION
|
||||
m_elements[i].m_sz = i;
|
||||
#endif //STATIC_SIMULATION_ISLAND_OPTIMIZATION
|
||||
#endif //STATIC_SIMULATION_ISLAND_OPTIMIZATION
|
||||
}
|
||||
|
||||
// Sort the vector using predicate and std::sort
|
||||
//std::sort(m_elements.begin(), m_elements.end(), btUnionFindElementSortPredicate);
|
||||
m_elements.quickSort(btUnionFindElementSortPredicate());
|
||||
|
||||
// Sort the vector using predicate and std::sort
|
||||
//std::sort(m_elements.begin(), m_elements.end(), btUnionFindElementSortPredicate);
|
||||
m_elements.quickSort(btUnionFindElementSortPredicate());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue