Пример #1
0
        // Merges a batch from a given actor with this one.
        public virtual void Merge(ObiActor actor, IObiConstraintsBatch other)
        {
            ObiConstraintsBatch batch = other as ObiConstraintsBatch;

            m_ConstraintCount              += other.constraintCount;
            m_ActiveConstraintCount        += other.activeConstraintCount;
            m_InitialActiveConstraintCount += other.initialActiveConstraintCount;
        }
 protected override void CopyConstraint(ObiConstraintsBatch batch, int constraintIndex)
 {
     if (batch is ObiDistanceConstraintsBatch)
     {
         var db = batch as ObiDistanceConstraintsBatch;
         RegisterConstraint();
         particleIndices.Add(batch.particleIndices[constraintIndex * 2]);
         particleIndices.Add(batch.particleIndices[constraintIndex * 2 + 1]);
         restLengths.Add(db.restLengths[constraintIndex]);
         stiffnesses.Add(db.stiffnesses[constraintIndex]);
         ActivateConstraint(constraintCount - 1);
     }
 }
        public ObiConstraintsBatch(ObiConstraintsBatch source)
        {
            this.source = source;

            if (source != null)
            {
                m_ConstraintCount              = source.m_ConstraintCount;
                m_ActiveConstraintCount        = source.m_ActiveConstraintCount;
                m_InitialActiveConstraintCount = source.m_InitialActiveConstraintCount;

                m_IDs       = new List <int>(source.m_IDs);
                m_IDToIndex = new List <int>(source.m_IDToIndex);
            }
        }
 // Moves a constraint to another batch: First, copies it to the new batch. Then, removes it from this one.
 public void MoveConstraintToBatch(int constraintIndex, ObiConstraintsBatch destBatch)
 {
     destBatch.CopyConstraint(this, constraintIndex);
     RemoveConstraint(constraintIndex);
 }
 protected virtual void CopyConstraint(ObiConstraintsBatch batch, int constraintIndex)
 {
 }