#include <b2BroadPhase.h>
Public Types | |
enum | { e_nullProxy = -1 } |
Public Member Functions | |
b2BroadPhase () | |
int32 | CreateProxy (const b2AABB &aabb, void *userData) |
void | DestroyProxy (int32 proxyId) |
Destroy a proxy. It is up to the client to remove any pairs. More... | |
const b2AABB & | GetFatAABB (int32 proxyId) const |
Get the fat AABB for a proxy. More... | |
int32 | GetProxyCount () const |
Get the number of proxies. More... | |
int32 | GetTreeBalance () const |
Get the balance of the embedded tree. More... | |
int32 | GetTreeHeight () const |
Get the height of the embedded tree. More... | |
float32 | GetTreeQuality () const |
Get the quality metric of the embedded tree. More... | |
void * | GetUserData (int32 proxyId) const |
Get user data from a proxy. Returns NULL if the id is invalid. More... | |
void | MoveProxy (int32 proxyId, const b2AABB &aabb, const b2Vec2 &displacement) |
template<typename T > | |
void | Query (T *callback, const b2AABB &aabb) const |
template<typename T > | |
void | RayCast (T *callback, const b2RayCastInput &input) const |
void | ShiftOrigin (const b2Vec2 &newOrigin) |
bool | TestOverlap (int32 proxyIdA, int32 proxyIdB) const |
Test overlap of fat AABBs. More... | |
void | TouchProxy (int32 proxyId) |
Call to trigger a re-processing of it's pairs on the next call to UpdatePairs. More... | |
template<typename T > | |
void | UpdatePairs (T *callback) |
Update the pairs. This results in pair callbacks. This can only add pairs. More... | |
~b2BroadPhase () | |
Private Member Functions | |
void | BufferMove (int32 proxyId) |
bool | QueryCallback (int32 proxyId) |
void | UnBufferMove (int32 proxyId) |
Private Attributes | |
int32 * | m_moveBuffer |
int32 | m_moveCapacity |
int32 | m_moveCount |
b2Pair * | m_pairBuffer |
int32 | m_pairCapacity |
int32 | m_pairCount |
int32 | m_proxyCount |
int32 | m_queryProxyId |
b2DynamicTree | m_tree |
Friends | |
class | b2DynamicTree |
The broad-phase is used for computing pairs and performing volume queries and ray casts. This broad-phase does not persist pairs. Instead, this reports potentially new pairs. It is up to the client to consume the new pairs and to track subsequent overlap.
Definition at line 36 of file b2BroadPhase.h.
anonymous enum |
Enumerator | |
---|---|
e_nullProxy |
Definition at line 40 of file b2BroadPhase.h.
b2BroadPhase::b2BroadPhase | ( | ) |
Definition at line 21 of file b2BroadPhase.cpp.
b2BroadPhase::~b2BroadPhase | ( | ) |
Definition at line 34 of file b2BroadPhase.cpp.
|
private |
Definition at line 69 of file b2BroadPhase.cpp.
Create a proxy with an initial AABB. Pairs are not reported until UpdatePairs is called.
Definition at line 40 of file b2BroadPhase.cpp.
void b2BroadPhase::DestroyProxy | ( | int32 | proxyId | ) |
Destroy a proxy. It is up to the client to remove any pairs.
Definition at line 48 of file b2BroadPhase.cpp.
Get the fat AABB for a proxy.
Definition at line 159 of file b2BroadPhase.h.
|
inline |
Get the number of proxies.
Definition at line 164 of file b2BroadPhase.h.
|
inline |
Get the balance of the embedded tree.
Definition at line 174 of file b2BroadPhase.h.
|
inline |
Get the height of the embedded tree.
Definition at line 169 of file b2BroadPhase.h.
|
inline |
Get the quality metric of the embedded tree.
Definition at line 179 of file b2BroadPhase.h.
|
inline |
Get user data from a proxy. Returns NULL if the id is invalid.
Definition at line 147 of file b2BroadPhase.h.
Call MoveProxy as many times as you like, then when you are done call UpdatePairs to finalized the proxy pairs (for your time step).
Definition at line 55 of file b2BroadPhase.cpp.
|
inline |
Query an AABB for overlapping proxies. The callback class is called for each proxy that overlaps the supplied AABB.
Definition at line 241 of file b2BroadPhase.h.
|
private |
Definition at line 96 of file b2BroadPhase.cpp.
|
inline |
Ray-cast against the proxies in the tree. This relies on the callback to perform a exact ray-cast in the case were the proxy contains a shape. The callback also performs the any collision filtering. This has performance roughly equal to k * log(n), where k is the number of collisions and n is the number of proxies in the tree.
input | the ray-cast input data. The ray extends from p1 to p1 + maxFraction * (p2 - p1). |
callback | a callback class that is called for each proxy that is hit by the ray. |
Definition at line 247 of file b2BroadPhase.h.
|
inline |
Shift the world origin. Useful for large worlds. The shift formula is: position -= newOrigin
newOrigin | the new origin with respect to the old origin |
Definition at line 252 of file b2BroadPhase.h.
Test overlap of fat AABBs.
Definition at line 152 of file b2BroadPhase.h.
void b2BroadPhase::TouchProxy | ( | int32 | proxyId | ) |
Call to trigger a re-processing of it's pairs on the next call to UpdatePairs.
Definition at line 64 of file b2BroadPhase.cpp.
|
private |
Definition at line 84 of file b2BroadPhase.cpp.
void b2BroadPhase::UpdatePairs | ( | T * | callback | ) |
Update the pairs. This results in pair callbacks. This can only add pairs.
Definition at line 185 of file b2BroadPhase.h.
|
friend |
Definition at line 109 of file b2BroadPhase.h.
|
private |
Definition at line 120 of file b2BroadPhase.h.
|
private |
Definition at line 121 of file b2BroadPhase.h.
|
private |
Definition at line 122 of file b2BroadPhase.h.
|
private |
Definition at line 124 of file b2BroadPhase.h.
|
private |
Definition at line 125 of file b2BroadPhase.h.
|
private |
Definition at line 126 of file b2BroadPhase.h.
|
private |
Definition at line 118 of file b2BroadPhase.h.
|
private |
Definition at line 128 of file b2BroadPhase.h.
|
private |
Definition at line 116 of file b2BroadPhase.h.