本文整理汇总了C#中ObjectArray.Sort方法的典型用法代码示例。如果您正苦于以下问题:C# ObjectArray.Sort方法的具体用法?C# ObjectArray.Sort怎么用?C# ObjectArray.Sort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectArray
的用法示例。
在下文中一共展示了ObjectArray.Sort方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SortOverlappingPairs
public virtual void SortOverlappingPairs(IDispatcher dispatcher)
{
ObjectArray<BroadphasePair> tmpPairs = new ObjectArray<BroadphasePair>();
tmpPairs.AddRange(m_overlappingPairArray);
for (int i = 0; i < tmpPairs.Count; i++)
{
RemoveOverlappingPair(tmpPairs[i].m_pProxy0, tmpPairs[i].m_pProxy1, dispatcher);
}
for (int i = 0; i < m_next.Count; i++)
{
m_next[i] = BT_NULL_PAIR;
}
tmpPairs.Sort();
//tmpPairs.quickSort(btBroadphasePairSortPredicate());
for (int i = 0; i < tmpPairs.Count; i++)
{
AddOverlappingPair(tmpPairs[i].m_pProxy0, tmpPairs[i].m_pProxy1);
}
}
示例2: SolveConstraints
protected virtual void SolveConstraints(ContactSolverInfo solverInfo)
{
//sorted version of all btTypedConstraint, based on islandId
ObjectArray<TypedConstraint> sortedConstraints = new ObjectArray<TypedConstraint>(GetNumConstraints());
if (BulletGlobals.g_streamWriter != null && debugDiscreteDynamicsWorld)
{
BulletGlobals.g_streamWriter.WriteLine("solveConstraints");
}
for (int i = 0; i < GetNumConstraints(); i++)
{
sortedConstraints.Add(m_constraints[i]);
}
// btAssert(0);
//sortedConstraints.quickSort(btSortConstraintOnIslandPredicate());
sortedConstraints.Sort(new SortConstraintOnIslandPredicate());
ObjectArray<TypedConstraint> constraintsPtr = GetNumConstraints() > 0 ? sortedConstraints : null;
InplaceSolverIslandCallback solverCallback = new InplaceSolverIslandCallback(solverInfo, m_constraintSolver, constraintsPtr, sortedConstraints.Count, m_debugDrawer, m_dispatcher1);
if (BulletGlobals.g_streamWriter != null && debugDiscreteDynamicsWorld)
{
BulletGlobals.g_streamWriter.WriteLine("prepareSolve");
}
m_constraintSolver.PrepareSolve(GetCollisionWorld().GetNumCollisionObjects(), GetCollisionWorld().GetDispatcher().GetNumManifolds());
if (BulletGlobals.g_streamWriter != null && debugDiscreteDynamicsWorld)
{
BulletGlobals.g_streamWriter.WriteLine("buildAndProcessIsland");
}
/// solve all the constraints for this island
m_islandManager.BuildAndProcessIslands(GetCollisionWorld().GetDispatcher(), GetCollisionWorld(), solverCallback);
solverCallback.ProcessConstraints();
m_constraintSolver.AllSolved(solverInfo, m_debugDrawer);
}