public override void AddToSolver() { // create and add the implementation: if (m_Constraints != null && m_Constraints.implementation != null) { m_BatchImpl = m_Constraints.implementation.CreateConstraintsBatch(); } if (m_BatchImpl != null) { lambdas.Clear(); for (int i = 0; i < particleIndices.count; i++) { particleIndices[i] = constraints.GetActor().solverIndices[m_Source.particleIndices[i]]; } for (int i = 0; i < orientations.count; i++) { orientations[i] = constraints.GetActor().actorLocalToSolverMatrix.rotation; } for (int i = 0; i < firstIndex.count; i++) { lambdas.Add(0); } m_BatchImpl.SetShapeMatchingConstraints(particleIndices, firstIndex, numIndices, explicitGroup, materialParameters, restComs, coms, orientations, lambdas, m_ConstraintCount); m_BatchImpl.SetActiveConstraints(m_ActiveConstraintCount); m_BatchImpl.CalculateRestShapeMatching(); } /*for (int i = 0; i < particleIndices.count; i++) * { * particleIndices[i] = constraints.GetActor().solverIndices[m_Source.particleIndices[i]]; * } * * for (int i = 0; i < orientations.count; i++) * orientations[i] = constraints.GetActor().actorLocalToSolverMatrix.rotation;*/ // pass constraint data arrays to the solver: //Oni.SetShapeMatchingConstraints(batch, particleIndices.GetIntPtr(), firstIndex.GetIntPtr(), numIndices.GetIntPtr(), explicitGroup.GetIntPtr(), //materialParameters.GetIntPtr(), restComs.GetIntPtr(), coms.GetIntPtr(), orientations.GetIntPtr(), m_ConstraintCount); //Oni.SetActiveConstraints(batch, m_ActiveConstraintCount); //Oni.CalculateRestShapeMatching(constraints.GetActor().solver.OniSolver, batch); }
public void RecalculateRestShapeMatching() { if (m_BatchImpl != null) { m_BatchImpl.CalculateRestShapeMatching(); } }
public override void AddToSolver(ObiSolver solver) { // Create distance constraints batch directly. m_BatchImpl = solver.implementation.CreateConstraintsBatch(constraintType) as IShapeMatchingConstraintsBatchImpl; if (m_BatchImpl != null) { m_BatchImpl.SetShapeMatchingConstraints(particleIndices, firstIndex, numIndices, explicitGroup, materialParameters, restComs, coms, orientations, lambdas, m_ActiveConstraintCount); m_BatchImpl.CalculateRestShapeMatching(); } }