Loading [MathJax]/extensions/tex2jax.js
A reimplementation of Mario Kart Wii's physics engine in C++
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages Concepts
Field::BoxColManager Class Reference

#include <BoxColManager.hh>

Description

Spatial indexing manager for entities with dynamic collision.

Definition at line 67 of file BoxColManager.hh.

Inheritance diagram for Field::BoxColManager:

Public Member Functions

 BoxColManager ()
 Creates two intangible units to represent the spatial bounds.
 
void clear ()
 
void calc ()
 Recalculate the bounds of all active units having PermRecalcAABB or TempRecalcAABB flag, and then update the low and high points accordingly.
 
ObjectCollidablegetNextObject ()
 
ObjectDrivablegetNextDrivable ()
 
void resetIterators ()
 
BoxColUnitinsertDriver (f32 radius, f32 maxSpeed, const EGG::Vector3f *pos, bool alwaysRecalc, Kart::KartObject *kartObject)
 
BoxColUnitinsertObject (f32 radius, f32 maxSpeed, const EGG::Vector3f *pos, bool alwaysRecalc, void *userData)
 
BoxColUnitinsertDrivable (f32 radius, f32 maxSpeed, const EGG::Vector3f *pos, bool alwaysRecalc, void *userData)
 
void reinsertUnit (BoxColUnit *unit)
 
void search (BoxColUnit *unit, const BoxColFlag &flag)
 
void search (f32 radius, const EGG::Vector3f &pos, const BoxColFlag &flag)
 
bool isSphereInSpatialCache (f32 radius, const EGG::Vector3f &pos, const BoxColFlag &flag) const
 

Static Public Member Functions

static BoxColManagerCreateInstance ()
 
static void DestroyInstance ()
 
static BoxColManagerInstance ()
 

Private Member Functions

void * getNextImpl (s32 &id, const BoxColFlag &flag)
 Helper function since the getters share all code except the flag.
 
void iterate (s32 &iter, const BoxColFlag &flag)
 
BoxColUnitinsert (f32 radius, f32 maxSpeed, const EGG::Vector3f *pos, const BoxColFlag &flag, void *userData)
 
void remove (BoxColUnit *&pUnit)
 
void searchImpl (BoxColUnit *unit, const BoxColFlag &flag)
 
void searchImpl (f32 radius, const EGG::Vector3f &pos, const BoxColFlag &flag)
 
- Private Member Functions inherited from EGG::Disposer

Private Attributes

std::array< BoxColHighPoint, MAX_UNIT_COUNT > m_highPoints
 A unit's rightmost Z-axis point.
 
std::array< BoxColLowPoint, MAX_UNIT_COUNT > m_lowPoints
 A unit's leftmost Z-axis point;.
 
std::array< BoxColUnit, MAX_UNIT_COUNT > m_unitPool
 Where all the units live.
 
std::array< BoxColUnit *, MAX_UNIT_COUNT > m_units
 Units within our search bounds.
 
std::array< u32, MAX_UNIT_COUNT > m_unitIDs
 Specifies what unit to retrieve from the pool during allocation.
 
s32 m_unitCount
 
s32 m_nextUnitID
 
s32 m_nextObjectID
 
s32 m_nextDrivableID
 
s32 m_maxID
 
BoxColUnitm_cacheQueryUnit
 
EGG::Vector3f m_cachePoint
 
f32 m_cacheRadius
 
BoxColFlag m_cacheFlag
 

Static Private Attributes

static constexpr size_t MAX_UNIT_COUNT = 0x100
 
static BoxColManagers_instance = nullptr
 

Additional Inherited Members

- Static Private Member Functions inherited from EGG::Disposer
static constexpr u16 getLinkOffset ()
 

Constructor & Destructor Documentation

◆ BoxColManager()

Field::BoxColManager::BoxColManager ( )
0x807856E0

Creates two intangible units to represent the spatial bounds.

Definition at line 53 of file BoxColManager.cc.

◆ ~BoxColManager()

Field::BoxColManager::~BoxColManager ( )
override0x807854E4

Definition at line 72 of file BoxColManager.cc.

Member Function Documentation

◆ calc()

void Field::BoxColManager::calc ( )
0x807859B0

Recalculate the bounds of all active units having PermRecalcAABB or TempRecalcAABB flag, and then update the low and high points accordingly.

Definition at line 92 of file BoxColManager.cc.

◆ clear()

void Field::BoxColManager::clear ( )
0x8078597C

Definition at line 80 of file BoxColManager.cc.

◆ CreateInstance()

BoxColManager * Field::BoxColManager::CreateInstance ( )
static0x807855DC

Definition at line 279 of file BoxColManager.cc.

◆ DestroyInstance()

void Field::BoxColManager::DestroyInstance ( )
static0x8078562C

Definition at line 286 of file BoxColManager.cc.

◆ getNextDrivable()

ObjectDrivable * Field::BoxColManager::getNextDrivable ( )
nodiscard0x80785EC4

Definition at line 188 of file BoxColManager.cc.

◆ getNextImpl()

void * Field::BoxColManager::getNextImpl ( s32 & id,
const BoxColFlag & flag )
nodiscardprivate

Helper function since the getters share all code except the flag.

Definition at line 298 of file BoxColManager.cc.

◆ getNextObject()

ObjectCollidable * Field::BoxColManager::getNextObject ( )
nodiscard0x80785E5C

Definition at line 183 of file BoxColManager.cc.

◆ insert()

BoxColUnit * Field::BoxColManager::insert ( f32 radius,
f32 maxSpeed,
const EGG::Vector3f * pos,
const BoxColFlag & flag,
void * userData )
nodiscardprivate0x80786134

Definition at line 321 of file BoxColManager.cc.

◆ insertDrivable()

BoxColUnit * Field::BoxColManager::insertDrivable ( f32 radius,
f32 maxSpeed,
const EGG::Vector3f * pos,
bool alwaysRecalc,
void * userData )
nodiscard0x80786120

Definition at line 226 of file BoxColManager.cc.

◆ insertDriver()

BoxColUnit * Field::BoxColManager::insertDriver ( f32 radius,
f32 maxSpeed,
const EGG::Vector3f * pos,
bool alwaysRecalc,
Kart::KartObject * kartObject )
nodiscard0x80786050

Definition at line 202 of file BoxColManager.cc.

◆ insertObject()

BoxColUnit * Field::BoxColManager::insertObject ( f32 radius,
f32 maxSpeed,
const EGG::Vector3f * pos,
bool alwaysRecalc,
void * userData )
nodiscard0x80786078

Definition at line 214 of file BoxColManager.cc.

◆ Instance()

BoxColManager * Field::BoxColManager::Instance ( )
staticnodiscard

Definition at line 293 of file BoxColManager.cc.

◆ isSphereInSpatialCache()

bool Field::BoxColManager::isSphereInSpatialCache ( f32 radius,
const EGG::Vector3f & pos,
const BoxColFlag & flag ) const
nodiscard0x80786E60

Definition at line 262 of file BoxColManager.cc.

◆ iterate()

void Field::BoxColManager::iterate ( s32 & iter,
const BoxColFlag & flag )
privateInlined

Definition at line 310 of file BoxColManager.cc.

◆ reinsertUnit()

void Field::BoxColManager::reinsertUnit ( BoxColUnit * unit)
0x80786DBC

Definition at line 238 of file BoxColManager.cc.

◆ remove()

void Field::BoxColManager::remove ( BoxColUnit *& pUnit)
private0x80786578

Definition at line 419 of file BoxColManager.cc.

◆ resetIterators()

void Field::BoxColManager::resetIterators ( )
0x80785F2C

Definition at line 193 of file BoxColManager.cc.

◆ search() [1/2]

void Field::BoxColManager::search ( BoxColUnit * unit,
const BoxColFlag & flag )
0x80786774

Definition at line 250 of file BoxColManager.cc.

◆ search() [2/2]

void Field::BoxColManager::search ( f32 radius,
const EGG::Vector3f & pos,
const BoxColFlag & flag )
0x80786B14

Definition at line 256 of file BoxColManager.cc.

◆ searchImpl() [1/2]

void Field::BoxColManager::searchImpl ( BoxColUnit * unit,
const BoxColFlag & flag )
private0x807868C0

Definition at line 474 of file BoxColManager.cc.

◆ searchImpl() [2/2]

void Field::BoxColManager::searchImpl ( f32 radius,
const EGG::Vector3f & pos,
const BoxColFlag & flag )
private0x80786C60

Definition at line 559 of file BoxColManager.cc.

Member Data Documentation

◆ m_cacheFlag

BoxColFlag Field::BoxColManager::m_cacheFlag
private

Definition at line 125 of file BoxColManager.hh.

◆ m_cachePoint

EGG::Vector3f Field::BoxColManager::m_cachePoint
private

Definition at line 123 of file BoxColManager.hh.

◆ m_cacheQueryUnit

BoxColUnit* Field::BoxColManager::m_cacheQueryUnit
private

Definition at line 122 of file BoxColManager.hh.

◆ m_cacheRadius

f32 Field::BoxColManager::m_cacheRadius
private

Definition at line 124 of file BoxColManager.hh.

◆ m_highPoints

std::array<BoxColHighPoint, MAX_UNIT_COUNT> Field::BoxColManager::m_highPoints
private

A unit's rightmost Z-axis point.

Definition at line 109 of file BoxColManager.hh.

◆ m_lowPoints

std::array<BoxColLowPoint, MAX_UNIT_COUNT> Field::BoxColManager::m_lowPoints
private

A unit's leftmost Z-axis point;.

Definition at line 110 of file BoxColManager.hh.

◆ m_maxID

s32 Field::BoxColManager::m_maxID
private

Definition at line 121 of file BoxColManager.hh.

◆ m_nextDrivableID

s32 Field::BoxColManager::m_nextDrivableID
private

Definition at line 120 of file BoxColManager.hh.

◆ m_nextObjectID

s32 Field::BoxColManager::m_nextObjectID
private

Definition at line 119 of file BoxColManager.hh.

◆ m_nextUnitID

s32 Field::BoxColManager::m_nextUnitID
private

Definition at line 118 of file BoxColManager.hh.

◆ m_unitCount

s32 Field::BoxColManager::m_unitCount
private

Definition at line 117 of file BoxColManager.hh.

◆ m_unitIDs

std::array<u32, MAX_UNIT_COUNT> Field::BoxColManager::m_unitIDs
private

Specifies what unit to retrieve from the pool during allocation.

Definition at line 115 of file BoxColManager.hh.

◆ m_unitPool

std::array<BoxColUnit, MAX_UNIT_COUNT> Field::BoxColManager::m_unitPool
private

Where all the units live.

Definition at line 111 of file BoxColManager.hh.

◆ m_units

std::array<BoxColUnit *, MAX_UNIT_COUNT> Field::BoxColManager::m_units
private

Units within our search bounds.

Definition at line 112 of file BoxColManager.hh.

◆ MAX_UNIT_COUNT

size_t Field::BoxColManager::MAX_UNIT_COUNT = 0x100
staticconstexprprivate

Definition at line 107 of file BoxColManager.hh.

◆ s_instance

BoxColManager * Field::BoxColManager::s_instance = nullptr
staticprivate0x809C2EF0

Definition at line 127 of file BoxColManager.hh.