#include <b2_broad_phase.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... | |
float | GetTreeQuality () const |
Get the quality metric of the embedded tree. More... | |
void * | GetUserData (int32 proxyId) const |
Get user data from a proxy. Returns nullptr 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 40 of file b2_broad_phase.h.
anonymous enum |
Enumerator | |
---|---|
e_nullProxy |
Definition at line 44 of file b2_broad_phase.h.
b2BroadPhase::b2BroadPhase | ( | ) |
Definition at line 26 of file b2_broad_phase.cpp.
b2BroadPhase::~b2BroadPhase | ( | ) |
Definition at line 39 of file b2_broad_phase.cpp.
Definition at line 74 of file b2_broad_phase.cpp.
Create a proxy with an initial AABB. Pairs are not reported until UpdatePairs is called.
Definition at line 45 of file b2_broad_phase.cpp.
Destroy a proxy. It is up to the client to remove any pairs.
Definition at line 53 of file b2_broad_phase.cpp.
Get the fat AABB for a proxy.
Definition at line 147 of file b2_broad_phase.h.
|
inline |
Get the number of proxies.
Definition at line 152 of file b2_broad_phase.h.
|
inline |
Get the balance of the embedded tree.
Definition at line 162 of file b2_broad_phase.h.
|
inline |
Get the height of the embedded tree.
Definition at line 157 of file b2_broad_phase.h.
|
inline |
Get the quality metric of the embedded tree.
Definition at line 167 of file b2_broad_phase.h.
Get user data from a proxy. Returns nullptr if the id is invalid.
Definition at line 135 of file b2_broad_phase.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 60 of file b2_broad_phase.cpp.
Query an AABB for overlapping proxies. The callback class is called for each proxy that overlaps the supplied AABB.
Definition at line 222 of file b2_broad_phase.h.
|
private |
Definition at line 101 of file b2_broad_phase.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 228 of file b2_broad_phase.h.
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 233 of file b2_broad_phase.h.
Test overlap of fat AABBs.
Definition at line 140 of file b2_broad_phase.h.
Call to trigger a re-processing of it's pairs on the next call to UpdatePairs.
Definition at line 69 of file b2_broad_phase.cpp.
Definition at line 89 of file b2_broad_phase.cpp.
void b2BroadPhase::UpdatePairs | ( | T * | callback | ) |
Update the pairs. This results in pair callbacks. This can only add pairs.
Definition at line 173 of file b2_broad_phase.h.
|
friend |
Definition at line 113 of file b2_broad_phase.h.
|
private |
Definition at line 124 of file b2_broad_phase.h.
|
private |
Definition at line 125 of file b2_broad_phase.h.
|
private |
Definition at line 126 of file b2_broad_phase.h.
|
private |
Definition at line 128 of file b2_broad_phase.h.
|
private |
Definition at line 129 of file b2_broad_phase.h.
|
private |
Definition at line 130 of file b2_broad_phase.h.
|
private |
Definition at line 122 of file b2_broad_phase.h.
|
private |
Definition at line 132 of file b2_broad_phase.h.
|
private |
Definition at line 120 of file b2_broad_phase.h.