Search in sources :

Example 6 with TypedConstraint

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;
}
Also used : ManifoldPoint(spacegraph.space3d.phys.collision.narrow.ManifoldPoint) SolverConstraint(spacegraph.space3d.phys.constraint.SolverConstraint) TypedConstraint(spacegraph.space3d.phys.constraint.TypedConstraint) ContactConstraint(spacegraph.space3d.phys.constraint.ContactConstraint) ManifoldPoint(spacegraph.space3d.phys.collision.narrow.ManifoldPoint) SolverConstraint(spacegraph.space3d.phys.constraint.SolverConstraint)

Aggregations

TypedConstraint (spacegraph.space3d.phys.constraint.TypedConstraint)6 ManifoldPoint (spacegraph.space3d.phys.collision.narrow.ManifoldPoint)4 ContactConstraint (spacegraph.space3d.phys.constraint.ContactConstraint)4 SolverConstraint (spacegraph.space3d.phys.constraint.SolverConstraint)4 Body3D (spacegraph.space3d.phys.Body3D)2 PersistentManifold (spacegraph.space3d.phys.collision.narrow.PersistentManifold)2 Collidable (spacegraph.space3d.phys.Collidable)1 BroadConstraint (spacegraph.space3d.phys.constraint.BroadConstraint)1 IntArrayList (spacegraph.space3d.phys.util.IntArrayList)1 Matrix3f (spacegraph.util.math.Matrix3f)1 spacegraph.util.math.v3 (spacegraph.util.math.v3)1