internal void TestSkin(CollisionSkin b, CollisionSkin s) { System.Diagnostics.Debug.Assert(b.Owner != null); System.Diagnostics.Debug.Assert(b.Owner.IsActive); if (!collisionPredicate_.ConsiderSkinPair(b, s)) { return; } info_.Skin0 = b; info_.Skin1 = s; int nSkin0 = info_.Skin0.NumPrimitives; int nSkin1 = info_.Skin1.NumPrimitives; for (info_.IndexPrim0 = 0; info_.IndexPrim0 != nSkin0; ++info_.IndexPrim0) { for (info_.IndexPrim1 = 0; info_.IndexPrim1 != nSkin1; ++info_.IndexPrim1) { if (CheckCollidables(info_.Skin0, info_.Skin1)) { DetectFunctor f = sys_.GetCollDetectFunctor(info_.Skin0.GetPrimitiveNewWorld(info_.IndexPrim0).Type, info_.Skin1.GetPrimitiveNewWorld(info_.IndexPrim1).Type); if (f != null) { f.CollDetect(info_, collTolerance_, collisionFunctor_); } } } } }
// BEN-OPTIMISATION: unsafe i.e. Remove array boundary checks. /// <summary> /// TestSkin /// </summary> /// <param name="b"></param> /// <param name="s"></param> internal unsafe void TestSkin(CollisionSkin b, CollisionSkin s) #endif { #if DEBUG System.Diagnostics.Debug.Assert(b.Owner != null); System.Diagnostics.Debug.Assert(b.Owner.IsActive); #endif if (!collisionPredicate_.ConsiderSkinPair(b, s)) { return; } info_.Skin0 = b; info_.Skin1 = s; int nSkin0 = info_.Skin0.NumPrimitives; int nSkin1 = info_.Skin1.NumPrimitives; // BEN-OPTIMISATION: Reuse detectFunctor. DetectFunctor detectFunctor; for (info_.IndexPrim0 = 0; info_.IndexPrim0 != nSkin0; ++info_.IndexPrim0) { for (info_.IndexPrim1 = 0; info_.IndexPrim1 != nSkin1; ++info_.IndexPrim1) { if (CheckCollidables(info_.Skin0, info_.Skin1)) { detectFunctor = sys_.GetCollDetectFunctor( info_.Skin0.GetPrimitiveNewWorld(info_.IndexPrim0).Type, info_.Skin1.GetPrimitiveNewWorld(info_.IndexPrim1).Type); if (detectFunctor != null) { detectFunctor.CollDetect(info_, collTolerance_, collisionFunctor_); } } } } }