SleakEngine 1.0.0
C++23 multi-backend game engine
Loading...
Searching...
No Matches
Sleak::Physics::DynamicAABBTree Class Reference

#include <DynamicAABBTree.hpp>

Public Member Functions

 DynamicAABBTree ()
 ~DynamicAABBTree ()=default
const AABBGetFatAABB (int proxyId) const
void * GetUserData (int proxyId) const
int Insert (const AABB &aabb, void *userData)
 Adds a new proxy with a fattened AABB and returns its id.
bool MoveProxy (int proxyId, const AABB &newAABB, const Vector3D &displacement)
 Refits a proxy's fat AABB to newAABB, re-inserting it only if it moved outside the fat margin.
void Query (const AABB &queryAABB, const std::function< bool(int)> &callback) const
 Visits every leaf whose fat AABB overlaps queryAABB; stop early by returning false from callback.
void RayCast (const Vector3D &origin, const Vector3D &direction, float maxDist, const std::function< bool(int)> &callback) const
 Walks the tree along a ray, visiting candidate leaves within maxDist.
void Remove (int proxyId)
 Removes a proxy and rebalances the tree around it.

Detailed Description

Broadphase AABB tree; PhysicsWorld inserts colliders as proxies and queries overlaps against it.

Definition at line 29 of file DynamicAABBTree.hpp.

Constructor & Destructor Documentation

◆ DynamicAABBTree()

Sleak::Physics::DynamicAABBTree::DynamicAABBTree ( )

Definition at line 9 of file DynamicAABBTree.cpp.

◆ ~DynamicAABBTree()

Sleak::Physics::DynamicAABBTree::~DynamicAABBTree ( )
default

Member Function Documentation

◆ GetFatAABB()

const AABB & Sleak::Physics::DynamicAABBTree::GetFatAABB ( int proxyId) const
inline

Definition at line 47 of file DynamicAABBTree.hpp.

◆ GetUserData()

void * Sleak::Physics::DynamicAABBTree::GetUserData ( int proxyId) const
inline

Definition at line 48 of file DynamicAABBTree.hpp.

◆ Insert()

int Sleak::Physics::DynamicAABBTree::Insert ( const AABB & aabb,
void * userData )

Adds a new proxy with a fattened AABB and returns its id.

Definition at line 58 of file DynamicAABBTree.cpp.

◆ MoveProxy()

bool Sleak::Physics::DynamicAABBTree::MoveProxy ( int proxyId,
const AABB & newAABB,
const Vector3D & displacement )

Refits a proxy's fat AABB to newAABB, re-inserting it only if it moved outside the fat margin.

Definition at line 73 of file DynamicAABBTree.cpp.

◆ Query()

void Sleak::Physics::DynamicAABBTree::Query ( const AABB & queryAABB,
const std::function< bool(int)> & callback ) const

Visits every leaf whose fat AABB overlaps queryAABB; stop early by returning false from callback.

Definition at line 327 of file DynamicAABBTree.cpp.

◆ RayCast()

void Sleak::Physics::DynamicAABBTree::RayCast ( const Vector3D & origin,
const Vector3D & direction,
float maxDist,
const std::function< bool(int)> & callback ) const

Walks the tree along a ray, visiting candidate leaves within maxDist.

Definition at line 351 of file DynamicAABBTree.cpp.

◆ Remove()

void Sleak::Physics::DynamicAABBTree::Remove ( int proxyId)

Removes a proxy and rebalances the tree around it.

Definition at line 68 of file DynamicAABBTree.cpp.