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

#include <CollisionDirector.hh>

Description

Manages the caching of colliding KCL triangles and exposes queries for collision checks.

Definition at line 15 of file CollisionDirector.hh.

Inheritance diagram for Field::CollisionDirector:

Classes

struct  CollisionEntry
 

Public Member Functions

void checkCourseColNarrScLocal (f32 radius, const EGG::Vector3f &pos, KCLTypeMask mask, u32 timeOffset)
 
bool checkSphereFull (f32 radius, const EGG::Vector3f &v0, const EGG::Vector3f &v1, KCLTypeMask flags, CollisionInfo *pInfo, KCLTypeMask *pFlagsOut, u32 timeOffset)
 
bool checkSphereFullPush (f32 radius, const EGG::Vector3f &v0, const EGG::Vector3f &v1, KCLTypeMask flags, CollisionInfo *pInfo, KCLTypeMask *pFlagsOut, u32 timeOffset)
 
bool checkSphereCachedPartial (f32 radius, const EGG::Vector3f &pos, const EGG::Vector3f &prevPos, KCLTypeMask typeMask, CollisionInfoPartial *info, KCLTypeMask *typeMaskOut, u32 timeOffset)
 
bool checkSphereCachedPartialPush (f32 radius, const EGG::Vector3f &pos, const EGG::Vector3f &prevPos, KCLTypeMask typeMask, CollisionInfoPartial *info, KCLTypeMask *typeMaskOut, u32 timeOffset)
 
bool checkSphereCachedFullPush (f32 radius, const EGG::Vector3f &pos, const EGG::Vector3f &prevPos, KCLTypeMask typeMask, CollisionInfo *info, KCLTypeMask *typeMaskOut, u32 timeOffset)
 
void resetCollisionEntries (KCLTypeMask *ptr)
 
void pushCollisionEntry (f32 dist, KCLTypeMask *typeMask, KCLTypeMask kclTypeBit, u16 attribute)
 Called when we find a piece of collision we are touching and want to save it temporarily.
 
void setCurrentCollisionVariant (u16 attribute)
 
void setCurrentCollisionTrickable (bool trickable)
 
bool findClosestCollisionEntry (KCLTypeMask *typeMask, KCLTypeMask type)
 Finds the closest KCL triangle out of the list of tris we are colliding with.
 

Static Public Member Functions

static CollisionDirectorCreateInstance ()
 
static void DestroyInstance ()
 
static CollisionDirectorInstance ()
 

Getters

const CollisionEntryclosestCollisionEntry () const
 

Private Attributes

const CollisionEntrym_closestCollisionEntry
 
std::array< CollisionEntry, COLLISION_ARR_LENGTH > m_entries
 
size_t m_collisionEntryCount
 

Static Private Attributes

static CollisionDirectors_instance = nullptr
 

Additional Inherited Members

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

Constructor & Destructor Documentation

◆ CollisionDirector()

Field::CollisionDirector::CollisionDirector ( )
private0x8078E33C

Definition at line 278 of file CollisionDirector.cc.

Member Function Documentation

◆ ~CollisionDirector()

Field::CollisionDirector::~CollisionDirector ( )
overrideprivate0x8078E454

Definition at line 285 of file CollisionDirector.cc.

◆ checkCourseColNarrScLocal()

void Field::CollisionDirector::checkCourseColNarrScLocal ( f32 radius,
const EGG::Vector3f & pos,
KCLTypeMask mask,
u32 timeOffset )
0x8078E4F0

Definition at line 8 of file CollisionDirector.cc.

◆ checkSphereCachedFullPush()

bool Field::CollisionDirector::checkSphereCachedFullPush ( f32 radius,
const EGG::Vector3f & pos,
const EGG::Vector3f & prevPos,
KCLTypeMask typeMask,
CollisionInfo * info,
KCLTypeMask * typeMaskOut,
u32 timeOffset )
nodiscard0x807907F8

Definition at line 175 of file CollisionDirector.cc.

◆ checkSphereCachedPartial()

bool Field::CollisionDirector::checkSphereCachedPartial ( f32 radius,
const EGG::Vector3f & pos,
const EGG::Vector3f & prevPos,
KCLTypeMask typeMask,
CollisionInfoPartial * info,
KCLTypeMask * typeMaskOut,
u32 timeOffset )
nodiscard0x807901F0

Definition at line 105 of file CollisionDirector.cc.

◆ checkSphereCachedPartialPush()

bool Field::CollisionDirector::checkSphereCachedPartialPush ( f32 radius,
const EGG::Vector3f & pos,
const EGG::Vector3f & prevPos,
KCLTypeMask typeMask,
CollisionInfoPartial * info,
KCLTypeMask * typeMaskOut,
u32 timeOffset )
nodiscard0x807903BC

Definition at line 145 of file CollisionDirector.cc.

◆ checkSphereFull()

bool Field::CollisionDirector::checkSphereFull ( f32 radius,
const EGG::Vector3f & v0,
const EGG::Vector3f & v1,
KCLTypeMask flags,
CollisionInfo * pInfo,
KCLTypeMask * pFlagsOut,
u32 timeOffset )
nodiscard0x8078F500

Definition at line 15 of file CollisionDirector.cc.

◆ checkSphereFullPush()

bool Field::CollisionDirector::checkSphereFullPush ( f32 radius,
const EGG::Vector3f & v0,
const EGG::Vector3f & v1,
KCLTypeMask flags,
CollisionInfo * pInfo,
KCLTypeMask * pFlagsOut,
u32 timeOffset )
nodiscard0x8078F784

Definition at line 60 of file CollisionDirector.cc.

◆ closestCollisionEntry()

const CollisionEntry * Field::CollisionDirector::closestCollisionEntry ( ) const
inlinenodiscard

Definition at line 70 of file CollisionDirector.hh.

◆ CreateInstance()

CollisionDirector * Field::CollisionDirector::CreateInstance ( )
static0x8078DFE8

Definition at line 263 of file CollisionDirector.cc.

◆ DestroyInstance()

void Field::CollisionDirector::DestroyInstance ( )
static0x8078E124

Definition at line 270 of file CollisionDirector.cc.

◆ findClosestCollisionEntry()

bool Field::CollisionDirector::findClosestCollisionEntry ( KCLTypeMask * typeMask,
KCLTypeMask type )
0x807BD96C

Finds the closest KCL triangle out of the list of tris we are colliding with.

Parameters
typeFilters the result for particular KCL types
Returns
Whether there was a collision entry for the provided type

Definition at line 246 of file CollisionDirector.cc.

◆ Instance()

static CollisionDirector * Field::CollisionDirector::Instance ( )
inlinestaticnodiscard

Definition at line 78 of file CollisionDirector.hh.

◆ pushCollisionEntry()

void Field::CollisionDirector::pushCollisionEntry ( f32 dist,
KCLTypeMask * typeMask,
KCLTypeMask kclTypeBit,
u16 attribute )
0x807BDA9C

Called when we find a piece of collision we are touching and want to save it temporarily.

Parameters
distDistance from player to the KCL traingle center
typeMaskUpdated to include kclTypeBit
kclTypeBitThe attribute and additional info about the tri we are colliding with
attributeThe base type of the tri we are colliding with

Definition at line 232 of file CollisionDirector.cc.

◆ resetCollisionEntries()

void Field::CollisionDirector::resetCollisionEntries ( KCLTypeMask * ptr)
0x807BDA7C

Definition at line 220 of file CollisionDirector.cc.

◆ setCurrentCollisionTrickable()

void Field::CollisionDirector::setCurrentCollisionTrickable ( bool trickable)
inline0x807BDBC4
Todo
Attributes should be represented as a bitfield. We can use a union. We will accomplish this in a future PR.

Definition at line 57 of file CollisionDirector.hh.

◆ setCurrentCollisionVariant()

void Field::CollisionDirector::setCurrentCollisionVariant ( u16 attribute)
inline0x807BDB5C
Todo
Attributes should be represented as a bitfield. We can use a union. We will accomplish this in a future PR.

Definition at line 48 of file CollisionDirector.hh.

Member Data Documentation

◆ m_closestCollisionEntry

const CollisionEntry* Field::CollisionDirector::m_closestCollisionEntry
private

Definition at line 86 of file CollisionDirector.hh.

◆ m_collisionEntryCount

size_t Field::CollisionDirector::m_collisionEntryCount
private

Definition at line 88 of file CollisionDirector.hh.

◆ m_entries

std::array<CollisionEntry, COLLISION_ARR_LENGTH> Field::CollisionDirector::m_entries
private

Definition at line 87 of file CollisionDirector.hh.

◆ s_instance

CollisionDirector * Field::CollisionDirector::s_instance = nullptr
staticprivate0x809C2F44

Definition at line 90 of file CollisionDirector.hh.