public OniConstraintsBatchImpl(IConstraints constraints, Oni.ConstraintType type) { this.m_Constraints = constraints; this.m_ConstraintType = type; m_OniBatch = Oni.CreateBatch((int)type); }
public override void Cook() { batch = Oni.CreateBatch((int)Oni.ConstraintType.Bending, true); // Send initial data to batch: Oni.SetBendingConstraints(batch, bendingIndices.ToArray(), restBends.ToArray(), bendingStiffnesses.ToArray(), ConstraintCount); // cook the batch and retrieve new sorted data: if (Oni.CookBatch(batch)) { constraintCount = Oni.GetBatchConstraintCount(batch); activeConstraints = Enumerable.Range(0, constraintCount).ToList(); int[] cookedIndices = new int[constraintCount * 3]; float[] cookedRestLengths = new float[constraintCount]; Vector2[] cookedStiffnesses = new Vector2[constraintCount]; Oni.GetBendingConstraints(batch, cookedIndices, cookedRestLengths, cookedStiffnesses); bendingIndices = new List <int>(cookedIndices); restBends = new List <float>(cookedRestLengths); bendingStiffnesses = new List <Vector2>(cookedStiffnesses); int phaseCount = Oni.GetBatchPhaseCount(batch); int[] phases = new int[phaseCount]; Oni.GetBatchPhaseSizes(batch, phases); this.phaseSizes = new List <int>(phases); } Oni.DestroyBatch(batch); batch = IntPtr.Zero; }
public void AddToSolver(IObiConstraints constraints) { // create a constraint batch: batch = Oni.CreateBatch((int)constraintType); Oni.AddBatch(constraints.GetActor().solver.OniSolver, batch); OnAddToSolver(constraints); }
public void AddToSolver(ObiBatchedConstraints constraints) { // create a constraint batch: batch = Oni.CreateBatch((int)GetConstraintType(), cooked); Oni.AddBatch(constraints.Actor.Solver.OniSolver, batch, sharesParticles); // custom stuff: OnAddToSolver(constraints); }
private void AddToSolver() { // create a constraint batch: batch = Oni.CreateBatch((int)Oni.ConstraintType.Stitch); Oni.AddBatch(actor1.solver.OniSolver, batch); inSolver = true; // push current data to solver: PushDataToSolver(); // enable/disable the batch: if (isActiveAndEnabled) { OnEnable(); } else { OnDisable(); } }
public bool AddToSolver(object info) { // create a constraint batch: batch = Oni.CreateBatch((int)Oni.ConstraintType.Stitch, false); Oni.AddBatch(actor1.Solver.OniSolver, batch, false); inSolver = true; // push current data to solver: PushDataToSolver(ParticleData.NONE); // enable/disable the batch: if (isActiveAndEnabled) { OnEnable(); } else { OnDisable(); } return(true); }
public override void Cook() { batch = Oni.CreateBatch((int)Oni.ConstraintType.Skin, true); // Send initial data to batch: Oni.SetSkinConstraints(batch, skinIndices.ToArray(), skinPoints.ToArray(), skinNormals.ToArray(), skinRadiiBackstop.ToArray(), skinStiffnesses.ToArray(), ConstraintCount); // cook the batch and retrieve new sorted data: if (Oni.CookBatch(batch)) { constraintCount = Oni.GetBatchConstraintCount(batch); activeConstraints = Enumerable.Range(0, constraintCount).ToList(); int[] cookedIndices = new int[constraintCount]; Vector4[] cookedPoints = new Vector4[constraintCount]; Vector4[] cookedNormals = new Vector4[constraintCount]; float[] cookedRadiiBackstop = new float[constraintCount * 3]; float[] cookedStiffnesses = new float[constraintCount]; Oni.GetSkinConstraints(batch, cookedIndices, cookedPoints, cookedNormals, cookedRadiiBackstop, cookedStiffnesses); skinIndices = new List <int>(cookedIndices); skinPoints = new List <Vector4>(cookedPoints); skinNormals = new List <Vector4>(cookedNormals); skinRadiiBackstop = new List <float>(cookedRadiiBackstop); skinStiffnesses = new List <float>(cookedStiffnesses); int phaseCount = Oni.GetBatchPhaseCount(batch); int[] phases = new int[phaseCount]; Oni.GetBatchPhaseSizes(batch, phases); this.phaseSizes = new List <int>(phases); } Oni.DestroyBatch(batch); batch = IntPtr.Zero; }