box2d4d.collision.b2BroadPhase



const uint16 b2_invalid ;


const uint16 b2_nullEdge ;


struct b2Bound ;


bool IsLower ();


bool IsUpper ();


uint16 value ;


uint16 proxyId ;


uint16 stabbingCount ;


class b2Proxy ;


ushort GetNext ();


void SetNext (ushort next);


bool IsValid ();


ushort[2u] lowerBounds ;


ushort[2u] upperBounds ;


uint16 overlapCount ;


uint16 timeStamp ;


Object userData ;


class b2BroadPhase ;


this(ref b2AABB worldAABB, b2PairCallback callback);


bool InRange (ref b2AABB aabb);
Use this to see if your proxy is in range. If it is not in range, it should be destroyed. Otherwise you may get O(m^2) pairs, where m is the number of proxies that are out of range.

b2Proxy GetProxy (int proxyId);


ushort CreateProxy (ref b2AABB aabb, Object userData);
Create and destroy proxies. These call Flush first.

void DestroyProxy (int proxyId);


void MoveProxy (int proxyId, ref b2AABB aabb);
Call MoveProxy as many times as you like, then when you are done call Commit to finalized the proxy pairs (for your time step).

void Commit ();


int Query (ref b2AABB aabb, Object[] userData, int maxCount);
Query an AABB for overlapping proxies, returns the user data and the count, up to the supplied maximum count.

void Validate ();


void ComputeBounds (ushort[] lowerValues, ushort[] upperValues, ref b2AABB aabb);


bool TestOverlap (ref b2Proxy p1, ref b2Proxy p2);
This one is only used for validation.

bool TestOverlap (ref b2BoundValues b, ref b2Proxy p);


void Query (ref int lowerQueryOut, ref int upperQueryOut, ushort lowerValue, ushort upperValue, b2Bound [] bounds, int boundCount, int axis);


void IncrementOverlapCount (int proxyId);


void IncrementTimeStamp ();


b2PairManager m_pairManager ;


b2Proxy[b2_maxProxies] m_proxyPool ;


uint16 m_freeProxy ;


b2Bound [1024u][2u] m_bounds ;


uint16[b2_maxProxies] m_queryResults ;


int32 m_queryResultCount ;


b2AABB m_worldAABB ;


b2Vec2 m_quantizationFactor ;


int32 m_proxyCount ;


uint16 m_timeStamp ;


static bool s_validate ;


struct b2BoundValues ;
Notes:
- we use bound arrays instead of linked lists for cache coherence. - we use quantized integral values for fast compares. - we use short indices rather than pointers to save memory. - we use a stabbing count for fast overlap queries (less than order N). - we also use a time stamp on each proxy to speed up the registration of overlap query results. - where possible, we compare bound indices instead of values to reduce cache misses (TODO_ERIN). - no broadphase is perfect and neither is this one: it is not great for huge worlds (use a multi-SAP instead), it is not great for large objects.

ushort[2u] lowerValues ;


ushort[2u] upperValues ;


static int BinarySearch (b2Bound [] bounds, int count, ushort value);


Page was generated with on Thu Jan 24 13:56:29 2008