A reimplementation of Mario Kart Wii's physics engine in C++
Loading...
Searching...
No Matches
Kinoko::Field::BoxColManager Class Reference

#include <BoxColManager.hh>

Description

Spatial indexing manager for entities with dynamic collision.

Definition at line 75 of file BoxColManager.hh.

Inheritance diagram for Kinoko::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 remove (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 searchImpl (BoxColUnit *unit, const BoxColFlag &flag)
void searchImpl (f32 radius, const EGG::Vector3f &pos, const BoxColFlag &flag)

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 Kinoko::EGG::Disposer
static constexpr u16 getLinkOffset ()

Constructor & Destructor Documentation

◆ BoxColManager()

Kinoko::Field::BoxColManager::BoxColManager ( )
0x807856E0

Creates two intangible units to represent the spatial bounds.

Definition at line 55 of file BoxColManager.cc.

◆ ~BoxColManager()

Kinoko::Field::BoxColManager::~BoxColManager ( )
override0x807854E4

Definition at line 74 of file BoxColManager.cc.

Member Function Documentation

◆ calc()

void Kinoko::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 94 of file BoxColManager.cc.

◆ clear()

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

Definition at line 82 of file BoxColManager.cc.

◆ CreateInstance()

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

Definition at line 337 of file BoxColManager.cc.

◆ DestroyInstance()

void Kinoko::Field::BoxColManager::DestroyInstance ( )
static0x8078562C

Definition at line 344 of file BoxColManager.cc.

◆ getNextDrivable()

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

Definition at line 190 of file BoxColManager.cc.

◆ getNextImpl()

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

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

Definition at line 356 of file BoxColManager.cc.

◆ getNextObject()

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

Definition at line 185 of file BoxColManager.cc.

◆ insert()

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

Definition at line 379 of file BoxColManager.cc.

◆ insertDrivable()

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

Definition at line 228 of file BoxColManager.cc.

◆ insertDriver()

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

Definition at line 204 of file BoxColManager.cc.

◆ insertObject()

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

Definition at line 216 of file BoxColManager.cc.

◆ Instance()

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

Definition at line 351 of file BoxColManager.cc.

◆ isSphereInSpatialCache()

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

Definition at line 320 of file BoxColManager.cc.

◆ iterate()

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

Definition at line 368 of file BoxColManager.cc.

◆ reinsertUnit()

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

Definition at line 240 of file BoxColManager.cc.

◆ remove()

void Kinoko::Field::BoxColManager::remove ( BoxColUnit *& unit)
0x80786578

Definition at line 252 of file BoxColManager.cc.

◆ resetIterators()

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

Definition at line 195 of file BoxColManager.cc.

◆ search() [1/2]

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

Definition at line 308 of file BoxColManager.cc.

◆ search() [2/2]

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

Definition at line 314 of file BoxColManager.cc.

◆ searchImpl() [1/2]

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

Definition at line 481 of file BoxColManager.cc.

◆ searchImpl() [2/2]

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

Definition at line 566 of file BoxColManager.cc.

Member Data Documentation

◆ m_cacheFlag

BoxColFlag Kinoko::Field::BoxColManager::m_cacheFlag
private

Definition at line 135 of file BoxColManager.hh.

◆ m_cachePoint

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

Definition at line 133 of file BoxColManager.hh.

◆ m_cacheQueryUnit

BoxColUnit* Kinoko::Field::BoxColManager::m_cacheQueryUnit
private

Definition at line 132 of file BoxColManager.hh.

◆ m_cacheRadius

f32 Kinoko::Field::BoxColManager::m_cacheRadius
private

Definition at line 134 of file BoxColManager.hh.

◆ m_highPoints

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

A unit's rightmost Z-axis point.

Definition at line 119 of file BoxColManager.hh.

◆ m_lowPoints

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

A unit's leftmost Z-axis point;.

Definition at line 120 of file BoxColManager.hh.

◆ m_maxID

s32 Kinoko::Field::BoxColManager::m_maxID
private

Definition at line 131 of file BoxColManager.hh.

◆ m_nextDrivableID

s32 Kinoko::Field::BoxColManager::m_nextDrivableID
private

Definition at line 130 of file BoxColManager.hh.

◆ m_nextObjectID

s32 Kinoko::Field::BoxColManager::m_nextObjectID
private

Definition at line 129 of file BoxColManager.hh.

◆ m_nextUnitID

s32 Kinoko::Field::BoxColManager::m_nextUnitID
private

Definition at line 128 of file BoxColManager.hh.

◆ m_unitCount

s32 Kinoko::Field::BoxColManager::m_unitCount
private

Definition at line 127 of file BoxColManager.hh.

◆ m_unitIDs

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

Specifies what unit to retrieve from the pool during allocation.

Definition at line 125 of file BoxColManager.hh.

◆ m_unitPool

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

Where all the units live.

Definition at line 121 of file BoxColManager.hh.

◆ m_units

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

Units within our search bounds.

Definition at line 122 of file BoxColManager.hh.

◆ MAX_UNIT_COUNT

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

Definition at line 117 of file BoxColManager.hh.

◆ s_instance

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

Definition at line 137 of file BoxColManager.hh.