use of spacegraph.space3d.phys.constraint.TypedConstraint in project narchy by automenta.
the class SequentialImpulseConstrainer method solveGroupCacheFriendly.
float solveGroupCacheFriendly(Collection<Collidable> bodies, int numBodies, FasterList<PersistentManifold> manifoldPtr, int manifold_offset, int numManifolds, FasterList<TypedConstraint> constraints, int constraints_offset, int numConstraints, ContactSolverInfo infoGlobal) /*,btStackAlloc* stackAlloc*/
{
solveGroupCacheFriendlySetup(bodies, numBodies, manifoldPtr, manifold_offset, numManifolds, constraints, constraints_offset, numConstraints, infoGlobal);
solveGroupCacheFriendlyIterations(bodies, numBodies, manifoldPtr, manifold_offset, numManifolds, constraints, constraints_offset, numConstraints, infoGlobal);
int numPoolConstraints = tmpSolverConstraintPool.size();
for (int j = 0; j < numPoolConstraints; j++) {
// return array[index];
SolverConstraint solveManifold = tmpSolverConstraintPool.get(j);
ManifoldPoint pt = (ManifoldPoint) solveManifold.originalContactPoint;
assert (pt != null);
pt.appliedImpulse = solveManifold.appliedImpulse;
// return array[index];
pt.appliedImpulseLateral1 = tmpSolverFrictionConstraintPool.get(solveManifold.frictionIndex).appliedImpulse;
// return array[index];
pt.appliedImpulseLateral1 = tmpSolverFrictionConstraintPool.get(solveManifold.frictionIndex + 1).appliedImpulse;
// do a callback here?
}
if (infoGlobal.splitImpulse) {
for (int i = 0; i < tmpSolverBodyPool.size(); i++) {
// return array[index];
tmpSolverBodyPool.get(i).writebackVelocity(infoGlobal.timeStep);
}
} else {
for (int i = 0; i < tmpSolverBodyPool.size(); i++) {
// return array[index];
tmpSolverBodyPool.get(i).writebackVelocity();
}
}
// printf("m_tmpSolverConstraintPool.size() = %i\n",m_tmpSolverConstraintPool.size());
/*
printf("m_tmpSolverBodyPool.size() = %i\n",m_tmpSolverBodyPool.size());
printf("m_tmpSolverConstraintPool.size() = %i\n",m_tmpSolverConstraintPool.size());
printf("m_tmpSolverFrictionConstraintPool.size() = %i\n",m_tmpSolverFrictionConstraintPool.size());
printf("m_tmpSolverBodyPool.capacity() = %i\n",m_tmpSolverBodyPool.capacity());
printf("m_tmpSolverConstraintPool.capacity() = %i\n",m_tmpSolverConstraintPool.capacity());
printf("m_tmpSolverFrictionConstraintPool.capacity() = %i\n",m_tmpSolverFrictionConstraintPool.capacity());
*/
tmpSolverBodyPool.clearFast();
tmpSolverConstraintPool.clearFast();
tmpSolverFrictionConstraintPool.clearFast();
return 0f;
}
Aggregations