public void UpdatePairs(BroadphaseDelegate callback) { this._pairCount = 0; for (int i = 0; i < this._moveCount; i++) { this._queryProxyId = this._moveBuffer[i]; bool flag = this._queryProxyId == -1; if (!flag) { AABB aABB; this._tree.GetFatAABB(this._queryProxyId, out aABB); this._tree.Query(this._queryCallback, ref aABB); } } this._moveCount = 0; Array.Sort<Pair>(this._pairBuffer, 0, this._pairCount); int j = 0; while (j < this._pairCount) { Pair pair = this._pairBuffer[j]; FixtureProxy userData = this._tree.GetUserData(pair.ProxyIdA); FixtureProxy userData2 = this._tree.GetUserData(pair.ProxyIdB); callback(ref userData, ref userData2); for (j++; j < this._pairCount; j++) { Pair pair2 = this._pairBuffer[j]; bool flag2 = pair2.ProxyIdA != pair.ProxyIdA || pair2.ProxyIdB != pair.ProxyIdB; if (flag2) { break; } } } }
public void UpdatePairs(BroadphaseDelegate callback) { _pairBuffer.Clear(); foreach (Element<FixtureProxy> qtnode in _moveBuffer) { // Query tree, create pairs and add them pair buffer. Query(proxyID => PairBufferQueryCallback(proxyID, qtnode.Value.ProxyId), ref qtnode.Span); } _moveBuffer.Clear(); // Sort the pair buffer to expose duplicates. _pairBuffer.Sort(); // Send the pairs back to the client. int i = 0; while (i < _pairBuffer.Count) { Pair primaryPair = _pairBuffer[i]; FixtureProxy userDataA = GetProxy(primaryPair.ProxyIdA); FixtureProxy userDataB = GetProxy(primaryPair.ProxyIdB); callback(ref userDataA, ref userDataB); ++i; // Skip any duplicate pairs. while (i < _pairBuffer.Count && _pairBuffer[i].ProxyIdA == primaryPair.ProxyIdA && _pairBuffer[i].ProxyIdB == primaryPair.ProxyIdB) ++i; } }
internal ContactManager() { ContactList = null; ContactCount = 0; OnBroadphaseCollision = AddPair; }
public void UpdatePairs(BroadphaseDelegate callback) { _pairBuffer.Clear(); foreach (Element <FixtureProxy> qtnode in _moveBuffer) { // Query tree, create pairs and add them pair buffer. Query(proxyID => PairBufferQueryCallback(proxyID, qtnode.Value.ProxyId), ref qtnode.Span); } _moveBuffer.Clear(); // Sort the pair buffer to expose duplicates. _pairBuffer.Sort(); // Send the pairs back to the client. int i = 0; while (i < _pairBuffer.Count) { Pair primaryPair = _pairBuffer[i]; callback(primaryPair.ProxyIdA, primaryPair.ProxyIdB); ++i; // Skip any duplicate pairs. while (i < _pairBuffer.Count && _pairBuffer[i].ProxyIdA == primaryPair.ProxyIdA && _pairBuffer[i].ProxyIdB == primaryPair.ProxyIdB) { ++i; } } }
internal ContactManager(IBroadPhase broadPhase) { ContactList = new ContactListHead(); ContactCount = 0; BroadPhase = broadPhase; OnBroadphaseCollision = AddPair; }
/// <summary> /// Update the pairs. This results in pair callbacks. This can only add pairs. /// </summary> /// <param name="callback">The callback.</param> public void UpdatePairs(BroadphaseDelegate callback) { // Reset pair buffer _pairCount = 0; // Perform tree queries for all moving proxies. for (int j = 0; j < _moveCount; ++j) { _queryProxyId = _moveBuffer[j]; if (_queryProxyId == nullProxy) { continue; } // We have to query the tree with the fat AABB so that // we don't fail to create a pair that may touch later. AABB fatAABB; _tree.GetFatAABB(_queryProxyId, out fatAABB); // Query tree, create pairs and add them pair buffer. _tree.Query(_queryCallback, ref fatAABB); } // Reset move buffer _moveCount = 0; // Sort the pair buffer to expose duplicates. Array.Sort(_pairBuffer, 0, _pairCount); // Send the pairs back to the client. int i = 0; while (i < _pairCount) { var primaryPair = _pairBuffer[i]; var userDataA = _tree.GetUserData(primaryPair.ProxyIdA); var userDataB = _tree.GetUserData(primaryPair.ProxyIdB); callback(ref userDataA, ref userDataB); ++i; // Skip any duplicate pairs. while (i < _pairCount) { var pair = _pairBuffer[i]; if (pair.ProxyIdA != primaryPair.ProxyIdA || pair.ProxyIdB != primaryPair.ProxyIdB) { break; } ++i; } } // Try to keep the tree balanced. //_tree.Rebalance(4); }
internal ContactManager(IBroadPhase <BodyProxy> broadPhase) { ContactList = new ContactListHead(); ContactCount = 0; _contactPoolList = new ContactListHead(); BroadPhase = broadPhase; OnBroadphaseCollision = AddPairBroadPhase; OnFixturePhaseCollision = AddPairFixturePhase; }
internal ContactManager(IBroadPhase broadPhase) { if (World.Multithreaded) { ThreadsToUse = Environment.ProcessorCount * 2; ThreadPool.SetMaxThreads(ThreadsToUse, ThreadsToUse); } ContactList = new ContactListHead(); ContactCount = 0; _contactPoolList = new ContactListHead(); BroadPhase = broadPhase; OnBroadphaseCollision += AddPair; }
internal ContactManager( IBroadPhase broadPhase ) { this.broadPhase = broadPhase; onBroadphaseCollision = addPair; }
internal ContactManager(IBroadPhase broadPhase) { BroadPhase = broadPhase; OnBroadphaseCollision = AddPair; }
/// <summary> /// Update the pairs. This results in pair callbacks. This can only add pairs. /// </summary> /// <param name="callback">The callback.</param> public void UpdatePairs(BroadphaseDelegate callback) { // Reset pair buffer _pairCount = 0; // Perform tree queries for all moving proxies. for (int j = 0; j < _moveCount; ++j) { _queryProxyId = _moveBuffer[j]; if (_queryProxyId == NullProxy) { continue; } // We have to query the tree with the fat AABB so that // we don't fail to create a pair that may touch later. AABB fatAABB = _tree.GetFatAABB(_queryProxyId); object body = _tree.GetBody(_queryProxyId); // Query tree, create pairs and add them pair buffer. _tree.Query(_queryCallback, ref fatAABB, ref body); } // Reset move buffer _moveCount = 0; // Sort the pair buffer to expose duplicates. //Array.Sort(_pairBuffer, 0, _pairCount); processedPairs.Clear(); // Send the pairs back to the client. int i = 0; while (i < _pairCount) { Pair primaryPair = _pairBuffer[i]; int pairID = primaryPair.ProxyIdA + (primaryPair.ProxyIdB << 16); if (!processedPairs.Contains(pairID)) { callback(primaryPair.ProxyIdA, primaryPair.ProxyIdB); processedPairs.Add(pairID); } ++i; // Skip any duplicate pairs. /*while (i < _pairCount) * { * Pair pair = _pairBuffer[i]; * if (pair.ProxyIdA != primaryPair.ProxyIdA || pair.ProxyIdB != primaryPair.ProxyIdB) * { * break; * } ++i; * }*/ } // Try to keep the tree balanced. //_tree.Rebalance(4); }
internal ContactManager(IBroadPhase broadPhase) { this.BroadPhase = broadPhase; this.OnBroadphaseCollision = new BroadphaseDelegate(this.AddPair); }
internal ContactManager(IBroadPhase broadPhase) { this.BroadPhase = broadPhase; this.OnBroadphaseCollision = this.AddPair; }
/// <summary> /// Serialization constructor. /// </summary> private ContactManager() { OnBroadphaseCollision = AddPair; }
internal ContactManager(IBroadPhase broadPhase) { this.broadPhase = broadPhase; onBroadphaseCollision = addPair; }
internal ContactManager(DynamicTreeBroadPhase broadPhase) { this.BroadPhase = broadPhase; OnBroadphaseCollision = AddPair; }
internal ContactManager(IBroadPhase broadPhase) { BroadPhase = broadPhase; OnBroadphaseCollision = AddPair; ContactList = new List <Contact>(128); }