当前位置: 首页>>代码示例>>C#>>正文


C# BroadphaseProxy类代码示例

本文整理汇总了C#中BroadphaseProxy的典型用法代码示例。如果您正苦于以下问题:C# BroadphaseProxy类的具体用法?C# BroadphaseProxy怎么用?C# BroadphaseProxy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BroadphaseProxy类属于命名空间,在下文中一共展示了BroadphaseProxy类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: NeedBroadphaseCollision

		// return true when pairs need collision
		public virtual bool NeedBroadphaseCollision(BroadphaseProxy childProxy0,BroadphaseProxy childProxy1)
		{
			BroadphaseProxy multiProxy0 = (BroadphaseProxy)childProxy0.m_multiSapParentProxy;
			BroadphaseProxy multiProxy1 = (BroadphaseProxy)childProxy1.m_multiSapParentProxy;
			
			bool collides = (multiProxy0.m_collisionFilterGroup & multiProxy1.m_collisionFilterMask) != 0;
			collides = collides && ((multiProxy1.m_collisionFilterGroup & multiProxy0.m_collisionFilterMask) != 0);
	
			return collides;
		}
开发者ID:HaKDMoDz,项目名称:InVision,代码行数:11,代码来源:MultiSapOverlapFilterCallback.cs

示例2: FindPair

        public BroadphasePair FindPair(BroadphaseProxy proxy0, BroadphaseProxy proxy1)
        {
            OverlappingPairCacheGlobals.gFindPairs++;
            if (proxy0.m_uniqueId > proxy1.m_uniqueId)
            {
                BroadphaseProxy temp;
                temp = proxy0;
                proxy0 = proxy1;
                proxy1 = temp;
            }
            int proxyId1 = proxy0.GetUid();
            int proxyId2 = proxy1.GetUid();

            /*if (proxyId1 > proxyId2) 
                btSwap(proxyId1, proxyId2);*/

            int hash = (int)(GetHash((uint)(proxyId1), (uint)(proxyId2)) & (m_overlappingPairArray.Capacity - 1));

            if (hash >= m_hashTable.Count)
            {
                return null;
            }

            int index = m_hashTable[hash];
            while (index != BT_NULL_PAIR && EqualsPair(m_overlappingPairArray[index], proxyId1, proxyId2) == false)
            {
                index = m_next[index];
            }

            if (index == BT_NULL_PAIR)
            {
                return null;
            }

            Debug.Assert(index < m_overlappingPairArray.Count);

            return m_overlappingPairArray[index];
        }
开发者ID:Belxjander,项目名称:Asuna,代码行数:38,代码来源:OverlappingPairCache.cs

示例3: Process

        public virtual bool Process(BroadphaseProxy proxy)
        {
            if (proxy.m_clientObject == m_collisionObject)
            {
                return true;
            }
            CollisionObject collisionObject = proxy.m_clientObject as CollisionObject;

            //only perform raycast if filterMask matches
            if (m_resultCallback.NeedsCollision(collisionObject.GetBroadphaseHandle()))
            {
                CollisionAlgorithm algorithm = m_world.GetDispatcher().FindAlgorithm(m_collisionObject, collisionObject);
                if (algorithm != null)
                {
                    BridgedManifoldResult contactPointResult = new BridgedManifoldResult(m_collisionObject, collisionObject, m_resultCallback);
                    //discrete collision detection query
                    algorithm.ProcessCollision(m_collisionObject, collisionObject, m_world.GetDispatchInfo(), contactPointResult);

                    m_world.GetDispatcher().FreeCollisionAlgorithm(algorithm);
                }
            }
            return true;
        }
开发者ID:Belxjander,项目名称:Asuna,代码行数:23,代码来源:CollisionWorld.cs

示例4: NeedsCollision

 public virtual bool NeedsCollision(BroadphaseProxy proxy0)
 {
     bool collides = (proxy0.m_collisionFilterGroup & m_collisionFilterMask) != 0;
     collides = collides && ((m_collisionFilterGroup & proxy0.m_collisionFilterMask) != 0);
     return collides;
 }
开发者ID:Belxjander,项目名称:Asuna,代码行数:6,代码来源:CollisionWorld.cs

示例5: RemoveOverlappingPairsContainingProxy

 public virtual void RemoveOverlappingPairsContainingProxy(BroadphaseProxy proxy0, IDispatcher dispatcher)
 {
     Debug.Assert(false);
     //need to keep track of all ghost objects and call them here
     //m_hashPairCache->removeOverlappingPairsContainingProxy(proxy0,dispatcher);
 }
开发者ID:JohnLouderback,项目名称:illuminati-engine-xna,代码行数:6,代码来源:GhostObject.cs

示例6: AddOverlappingPair

 public virtual BroadphasePair AddOverlappingPair(BroadphaseProxy proxy0, BroadphaseProxy proxy1)
 {
     CollisionObject colObj0 = proxy0.m_clientObject as CollisionObject;
     CollisionObject colObj1 = proxy1.m_clientObject as CollisionObject;
     GhostObject ghost0 = GhostObject.Upcast(colObj0);
     GhostObject ghost1 = GhostObject.Upcast(colObj1);
     if (ghost0 != null)
     {
         ghost0.AddOverlappingObjectInternal(proxy1, proxy0);
     }
     if (ghost1 != null)
     {
         ghost1.AddOverlappingObjectInternal(proxy0, proxy1);
     }
     return null;
 }
开发者ID:JohnLouderback,项目名称:illuminati-engine-xna,代码行数:16,代码来源:GhostObject.cs

示例7: AddOverlappingObjectInternal

        ///this method is mainly for expert/internal use only.
        public override void AddOverlappingObjectInternal(BroadphaseProxy otherProxy, BroadphaseProxy thisProxy)
        {
            BroadphaseProxy actualThisProxy = thisProxy != null ? thisProxy : GetBroadphaseHandle();
            Debug.Assert(actualThisProxy != null);

            CollisionObject otherObject = otherProxy.m_clientObject as CollisionObject;
            Debug.Assert(otherObject != null);
            if (!m_overlappingObjects.Contains(otherObject))
            {
                m_overlappingObjects.Add(otherObject);
                m_hashPairCache.AddOverlappingPair(actualThisProxy, otherProxy);
            }
        }
开发者ID:JohnLouderback,项目名称:illuminati-engine-xna,代码行数:14,代码来源:GhostObject.cs

示例8: NeedsBroadphaseCollision

 public bool NeedsBroadphaseCollision(BroadphaseProxy proxy0, BroadphaseProxy proxy1)
 {
     if (m_overlapFilterCallback != null)
     {
         return m_overlapFilterCallback.NeedBroadphaseCollision(proxy0, proxy1);
     }
     bool collides = (proxy0.m_collisionFilterGroup & proxy1.m_collisionFilterMask) != 0;
     collides = collides && ((proxy1.m_collisionFilterGroup & proxy0.m_collisionFilterMask) != 0);
     return collides;
 }
开发者ID:Belxjander,项目名称:Asuna,代码行数:10,代码来源:OverlappingPairCache.cs

示例9: CleanProxyFromPairs

 public void CleanProxyFromPairs(BroadphaseProxy proxy, IDispatcher dispatcher)
 {
     CleanPairCallback cleanPairs = new CleanPairCallback(proxy, this, dispatcher);
     ProcessAllOverlappingPairs(cleanPairs, dispatcher);
 }
开发者ID:Belxjander,项目名称:Asuna,代码行数:5,代码来源:OverlappingPairCache.cs

示例10: AddOverlappingPair

        public BroadphasePair AddOverlappingPair(BroadphaseProxy proxy0, BroadphaseProxy proxy1)
        {
            //don't add overlap with own
            Debug.Assert(proxy0 != proxy1);

            if (!NeedsBroadphaseCollision(proxy0, proxy1))
            {
                return null;
            }
            
            BroadphasePair pair = new BroadphasePair(proxy0, proxy1);
            m_overlappingPairArray.Add(pair);

            OverlappingPairCacheGlobals.gOverlappingPairs++;
            OverlappingPairCacheGlobals.gAddedPairs++;

            if (m_ghostPairCallback != null)
            {
                m_ghostPairCallback.AddOverlappingPair(proxy0, proxy1);
            }
            return pair;
        }
开发者ID:Belxjander,项目名称:Asuna,代码行数:22,代码来源:OverlappingPairCache.cs

示例11: RemoveOverlappingPair

        public Object RemoveOverlappingPair(BroadphaseProxy proxy0, BroadphaseProxy proxy1, IDispatcher dispatcher)
        {
            if (!HasDeferredRemoval())
            {
                BroadphasePair findPair = new BroadphasePair(proxy0, proxy1);

                int findIndex = m_overlappingPairArray.IndexOf(findPair);
                if (findIndex >= 0 && findIndex < m_overlappingPairArray.Count)
                {
                    OverlappingPairCacheGlobals.gOverlappingPairs--;
                    BroadphasePair pair = m_overlappingPairArray[findIndex];
                    Object userData = pair.m_internalInfo1;
                    CleanOverlappingPair(pair, dispatcher);
                    if (m_ghostPairCallback != null)
                    {
                        m_ghostPairCallback.RemoveOverlappingPair(proxy0, proxy1, dispatcher);
                    }
                    //BroadphasePair temp = m_overlappingPairArray[findIndex];
                    //m_overlappingPairArray[findIndex] = m_overlappingPairArray[m_overlappingPairArray.Count-1];
                    //m_overlappingPairArray[m_overlappingPairArray.Count-1] = temp;
                    m_overlappingPairArray.RemoveAtQuick(findIndex);
                    return userData;
                }
            }

            return null;
        }
开发者ID:Belxjander,项目名称:Asuna,代码行数:27,代码来源:OverlappingPairCache.cs

示例12: InternalFindPair

        public BroadphasePair InternalFindPair(BroadphaseProxy proxy0, BroadphaseProxy proxy1, int hash)
        {
            BroadphasePair[] rawPairArray = m_overlappingPairArray.GetRawArray();
            int proxyId1 = proxy0.GetUid();
            int proxyId2 = proxy1.GetUid();
            //#if 0 // wrong, 'equalsPair' use unsorted uids, copy-past devil striked again. Nat.
            //if (proxyId1 > proxyId2) 
            //    btSwap(proxyId1, proxyId2);
            //#endif

            int index = m_hashTable[hash];

            while (index != BT_NULL_PAIR && EqualsPair(rawPairArray[index], proxyId1, proxyId2) == false)
            {
                index = m_next[index];
            }

            if (index == BT_NULL_PAIR)
            {
                return null;
            }

            //btAssert(index < m_overlappingPairArray.size());
            // if we know this then don't we don't need to look it up again..
            rawPairArray[index].m_index = index;
            return rawPairArray[index];
        }
开发者ID:Belxjander,项目名称:Asuna,代码行数:27,代码来源:OverlappingPairCache.cs

示例13: InternalAddPair

        private BroadphasePair InternalAddPair(BroadphaseProxy proxy0, BroadphaseProxy proxy1)
        {
            if (proxy0.m_uniqueId > proxy1.m_uniqueId)
            {
                BroadphaseProxy temp = proxy0;
                proxy0 = proxy1;
                proxy1 = temp;
            }

            int proxyId1 = proxy0.GetUid();
            int proxyId2 = proxy1.GetUid();


            int hash = (int)(GetHash((uint)proxyId1, (uint)proxyId2) & (m_overlappingPairArray.Capacity - 1));	// New hash value with new mask

            BroadphasePair pair = InternalFindPair(proxy0, proxy1, hash);
            if (pair != null)
            {
                return pair;
            }
            else
            {
                /*for(int i=0;i<m_overlappingPairArray.size();++i)
                    {
                    if(	(m_overlappingPairArray[i].m_pProxy0==proxy0)&&
                        (m_overlappingPairArray[i].m_pProxy1==proxy1))
                        {
                        printf("Adding duplicated %u<>%u\r\n",proxyId1,proxyId2);
                        internalFindPair(proxy0, proxy1, hash);
                        }
                    }*/
                int count = m_overlappingPairArray.Count;
                int oldCapacity = m_overlappingPairArray.Capacity;

                // MAN - 2.76 - uses expand noninitializing....??
                //void* mem = &m_overlappingPairArray.expand();

                //this is where we add an actual pair, so also call the 'ghost'
                if (m_ghostPairCallback != null)
                {
                    m_ghostPairCallback.AddOverlappingPair(proxy0, proxy1);
                }
                pair = new BroadphasePair(proxy0, proxy1);
                m_overlappingPairArray.Add(pair);

                int newCapacity = m_overlappingPairArray.Capacity;

                if (oldCapacity < newCapacity)
                {
                    GrowTables();
                    //hash with new capacity
                    hash = (int)(GetHash((uint)(proxyId1), (uint)(proxyId2)) & (m_overlappingPairArray.Capacity - 1));
                }


                m_next[count] = m_hashTable[hash];
                m_hashTable[hash] = count;

                return pair;
            }
        }
开发者ID:Belxjander,项目名称:Asuna,代码行数:61,代码来源:OverlappingPairCache.cs

示例14: RemoveOverlappingPairsContainingProxy

 public virtual void RemoveOverlappingPairsContainingProxy(BroadphaseProxy proxy, IDispatcher dispatcher)
 {
     RemovePairCallback removeCallback = new RemovePairCallback(proxy);
     ProcessAllOverlappingPairs(removeCallback, dispatcher);
 }
开发者ID:Belxjander,项目名称:Asuna,代码行数:5,代码来源:OverlappingPairCache.cs

示例15: RemoveOverlappingObjectInternal

 ///this method is mainly for expert/internal use only.
 public virtual void RemoveOverlappingObjectInternal(BroadphaseProxy otherProxy, IDispatcher dispatcher, BroadphaseProxy thisProxy)
 {
     CollisionObject otherObject = otherProxy.m_clientObject as CollisionObject;
     Debug.Assert(otherObject != null);
     ///if this linearSearch becomes too slow (too many overlapping objects) we should add a more appropriate data structure
     {
         m_overlappingObjects.RemoveQuick(otherObject);
     }
 }
开发者ID:JohnLouderback,项目名称:illuminati-engine-xna,代码行数:10,代码来源:GhostObject.cs


注:本文中的BroadphaseProxy类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。