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

#include <ObjectPillar.hh>

Description

Represents the entirety of a pillar that falls on Dry Dry Ruins.

There are really three parts that comprise a pillar: the upright pillar collision, the pilar base collision, and the trickable pillar KCL once it has fallen.

Definition at line 64 of file ObjectPillar.hh.

Inheritance diagram for Kinoko::Field::ObjectPillar:

Public Member Functions

 ObjectPillar (const System::MapdataGeoObj &params)
void init () override
void calc () override
LoadFlags loadFlags () const override
 Returns a bitmask indicating which lifecycle hooks should be called for the object.
f32 colRadiusAdditionalLength () const override
const EGG::Matrix34f & getUpdatedMatrix (u32 timeOffset) override
Public Member Functions inherited from Kinoko::Field::ObjectKCL
 ObjectKCL (const System::MapdataGeoObj &params)
void createCollision () override
void calcCollisionTransform () override
const EGG::Vector3f & getPosition () const override
f32 getCollisionRadius () const override
void initCollision () override
bool checkPointPartial (const EGG::Vector3f &pos, const EGG::Vector3f &prevPos, KCLTypeMask mask, CollisionInfoPartial *info, KCLTypeMask *maskOut) override
bool checkPointPartialPush (const EGG::Vector3f &pos, const EGG::Vector3f &prevPos, KCLTypeMask mask, CollisionInfoPartial *info, KCLTypeMask *maskOut) override
bool checkPointFull (const EGG::Vector3f &pos, const EGG::Vector3f &prevPos, KCLTypeMask mask, CollisionInfo *info, KCLTypeMask *maskOut) override
bool checkPointFullPush (const EGG::Vector3f &pos, const EGG::Vector3f &prevPos, KCLTypeMask mask, CollisionInfo *info, KCLTypeMask *maskOut) override
bool checkSpherePartial (f32 radius, const EGG::Vector3f &pos, const EGG::Vector3f &prevPos, KCLTypeMask mask, CollisionInfoPartial *info, KCLTypeMask *maskOut, u32 timeOffset) override
bool checkSpherePartialPush (f32 radius, const EGG::Vector3f &pos, const EGG::Vector3f &prevPos, KCLTypeMask mask, CollisionInfoPartial *info, KCLTypeMask *maskOut, u32 timeOffset) override
bool checkSphereFull (f32 radius, const EGG::Vector3f &pos, const EGG::Vector3f &prevPos, KCLTypeMask mask, CollisionInfo *info, KCLTypeMask *maskOut, u32 timeOffset) override
bool checkSphereFullPush (f32 radius, const EGG::Vector3f &pos, const EGG::Vector3f &prevPos, KCLTypeMask mask, CollisionInfo *info, KCLTypeMask *maskOut, u32 timeOffset) override
void narrScLocal (f32 radius, const EGG::Vector3f &pos, KCLTypeMask mask, u32 timeOffset) override
bool checkPointCachedPartial (const EGG::Vector3f &pos, const EGG::Vector3f &prevPos, KCLTypeMask mask, CollisionInfoPartial *info, KCLTypeMask *maskOut) override
bool checkPointCachedPartialPush (const EGG::Vector3f &pos, const EGG::Vector3f &prevPos, KCLTypeMask mask, CollisionInfoPartial *info, KCLTypeMask *maskOut) override
bool checkPointCachedFull (const EGG::Vector3f &pos, const EGG::Vector3f &prevPos, KCLTypeMask mask, CollisionInfo *info, KCLTypeMask *maskOut) override
bool checkPointCachedFullPush (const EGG::Vector3f &pos, const EGG::Vector3f &prevPos, KCLTypeMask mask, CollisionInfo *info, KCLTypeMask *maskOut) override
bool checkSphereCachedPartial (f32 radius, const EGG::Vector3f &pos, const EGG::Vector3f &prevPos, KCLTypeMask mask, CollisionInfoPartial *info, KCLTypeMask *maskOut, u32 timeOffset) override
bool checkSphereCachedPartialPush (f32 radius, const EGG::Vector3f &pos, const EGG::Vector3f &prevPos, KCLTypeMask mask, CollisionInfoPartial *info, KCLTypeMask *maskOut, u32 timeOffset) override
bool checkSphereCachedFull (f32 radius, const EGG::Vector3f &pos, const EGG::Vector3f &prevPos, KCLTypeMask mask, CollisionInfo *info, KCLTypeMask *maskOut, u32 timeOffset) override
bool checkSphereCachedFullPush (f32 radius, const EGG::Vector3f &pos, const EGG::Vector3f &prevPos, KCLTypeMask mask, CollisionInfo *info, KCLTypeMask *maskOut, u32 timeOffset) override
virtual void update (u32 timeOffset)
virtual void calcScale (u32 timeOffset)
virtual void setMovingObjVel (const EGG::Vector3f &v)
virtual f32 getScaleY (u32) const
virtual bool shouldCheckColNoPush () const
virtual bool shouldCheckColPush () const
virtual bool checkCollision (f32 radius, const EGG::Vector3f &pos, const EGG::Vector3f &prevPos, KCLTypeMask mask, CollisionInfo *info, KCLTypeMask *maskOut, u32 timeOffset)
virtual bool checkCollisionCached (f32 radius, const EGG::Vector3f &pos, const EGG::Vector3f &prevPos, KCLTypeMask mask, CollisionInfo *info, KCLTypeMask *maskOut, u32 timeOffset)
Public Member Functions inherited from Kinoko::Field::ObjectDrivable
 ObjectDrivable (const System::MapdataGeoObj &params)
void load () override
virtual void loadAABB (f32 radius)
Public Member Functions inherited from Kinoko::Field::ObjectBase
 ObjectBase (const System::MapdataGeoObj &params)
 ObjectBase (const char *name, const EGG::Vector3f &pos, const EGG::Vector3f &rot, const EGG::Vector3f &scale)
virtual void calcModel ()
virtual const char * getResources () const
virtual void loadGraphics ()
virtual void loadAnims ()
virtual void loadRail ()
virtual const char * getName () const
virtual const char * getKclName () const
virtual void resize (f32 radius, f32 maxSpeed)
virtual void unregisterCollision ()
virtual void disableCollision () const
virtual void enableCollision () const
virtual const BoxColUnit * getUnit () const
const RailInterpolator * railInterpolator () const
virtual ObjectId id () const
void setPos (const EGG::Vector3f &pos)
void addPos (const EGG::Vector3f &v)
void subPos (const EGG::Vector3f &v)
void setScale (const EGG::Vector3f &scale)
void setScale (f32 scale)
void setRot (const EGG::Vector3f &rot)
void setRotNoFlag (const EGG::Vector3f &rot)
void addRot (const EGG::Vector3f &v)
void subRot (const EGG::Vector3f &v)
void setTransform (const EGG::Matrix34f &mat)
const EGG::Vector3f & pos () const
const EGG::Vector3f & scale () const
const EGG::Vector3f & rot () const
const EGG::Matrix34f & transform ()

Private Types

enum class  State {
  Upright = 0 ,
  Break = 1 ,
  Ground = 2
}

Private Member Functions

f32 calcRot (s32 frame) const

Private Attributes

State m_state
 0 when upright, 1 when falling, and 2 afterwards.
const u32 m_fallStart
 The number of frames before the pillar will start to fall.
const f32 m_targetRotation
 How much the pillar rotates during the fall, in radians.
const f32 m_initRot
EGG::Vector3f m_setupRot
 Initial rotation of the pillar.
ObjectPillarBase * m_base
 Stationary portion of pillar.
ObjectPillarC * m_collidable
 Wall and hazard collision of the upright/falling pillar.
EGG::Matrix34f m_workMat
 Rotation and translation matrix;.
s32 m_groundFrame
 Frame the pillar has finished falling.

Additional Inherited Members

Public Types inherited from Kinoko::Field::ObjectBase
enum class  eFlags {
  Position = 0 ,
  Rotation = 1 ,
  Matrix = 2 ,
  Scale = 3
}
enum class  eLoadFlags {
  Calc = 0 ,
  Draw = 1 ,
  AlwaysRecalc = 2
}
 Describes whether the object needs to be updated every frame. More...
typedef EGG::TBitFlag< u16, eFlags > Flags
typedef EGG::TBitFlag< u8, eLoadFlags > LoadFlags
 A bitfield of eLoadFlags that represents the update requirements of the object.
Protected Member Functions inherited from Kinoko::Field::ObjectBase
void calcTransform ()
void calcRotLock ()
void linkAnims (const std::span< const char * > &names, const std::span< Render::AnmType > types)
void setMatrixTangentTo (const EGG::Vector3f &up, const EGG::Vector3f &tangent)
void setMatrixFromOrthonormalBasisAndPos (const EGG::Vector3f &v)
Static Protected Member Functions inherited from Kinoko::Field::ObjectBase
static f32 CheckPointAgainstLineSegment (const EGG::Vector3f &point, const EGG::Vector3f &a, const EGG::Vector3f &b)
 Calculates on what side of line segment ab point lies.
static EGG::Vector3f RotateXZByYaw (f32 angle, const EGG::Vector3f &v)
 Rotates a vector around the Y-axis and returns the XZ-plane portion of the vector.
static EGG::Vector3f RotateAxisAngle (f32 angle, const EGG::Vector3f &axis, const EGG::Vector3f &v1)
static void SetRotTangentHorizontal (EGG::Matrix34f &mat, const EGG::Vector3f &up, const EGG::Vector3f &tangent)
static EGG::Matrix34f OrthonormalBasis (const EGG::Vector3f &v)
static EGG::Vector3f AdjustVecForward (f32 sidewaysScalar, f32 forwardScalar, f32 minSpeed, const EGG::Vector3f &src, EGG::Vector3f forward)
static f32 CalcParabolicDisplacement (f32 initVel, f32 accel, u32 frame)
 Solves the standard kinematic equation \(y(t) = v_0\, t - \frac{1}{2} a t^{2}\).
static EGG::Vector3f Interpolate (f32 t, const EGG::Vector3f &v0, const EGG::Vector3f &v1)
Protected Attributes inherited from Kinoko::Field::ObjectKCL
ObjColMgr * m_objColMgr
EGG::Vector3f m_kclMidpoint
f32 m_bboxHalfSideLength
s32 m_lastMtxUpdateFrame
s32 m_lastScaleUpdateFrame
Protected Attributes inherited from Kinoko::Field::ObjectBase
Render::DrawMdl * m_drawMdl
Abstract::g3d::ResFile * m_resFile
ObjectId m_id
RailInterpolator * m_railInterpolator
BoxColUnit * m_boxColUnit
const System::MapdataGeoObj * m_mapObj

Member Enumeration Documentation

◆ State

enum class Kinoko::Field::ObjectPillar::State
strongprivate

Definition at line 85 of file ObjectPillar.hh.

Constructor & Destructor Documentation

◆ ObjectPillar()

Kinoko::Field::ObjectPillar::ObjectPillar ( const System::MapdataGeoObj & params)
0x807FED80

Definition at line 41 of file ObjectPillar.cc.

◆ ~ObjectPillar()

Kinoko::Field::ObjectPillar::~ObjectPillar ( )
overridedefault0x807FFA34

Member Function Documentation

◆ calc()

void Kinoko::Field::ObjectPillar::calc ( )
overridevirtual0x807FF17C

Reimplemented from Kinoko::Field::ObjectBase.

Definition at line 67 of file ObjectPillar.cc.

◆ calcRot()

f32 Kinoko::Field::ObjectPillar::calcRot ( s32 frame) const
nodiscardprivate0x807FF90C

Definition at line 105 of file ObjectPillar.cc.

◆ colRadiusAdditionalLength()

f32 Kinoko::Field::ObjectPillar::colRadiusAdditionalLength ( ) const
inlinenodiscardoverridevirtual0x807FF980

Reimplemented from Kinoko::Field::ObjectKCL.

Definition at line 78 of file ObjectPillar.hh.

◆ getUpdatedMatrix()

const EGG::Matrix34f & Kinoko::Field::ObjectPillar::getUpdatedMatrix ( u32 timeOffset)
nodiscardoverridevirtual0x807FF83C

Reimplemented from Kinoko::Field::ObjectKCL.

Definition at line 98 of file ObjectPillar.cc.

◆ init()

void Kinoko::Field::ObjectPillar::init ( )
overridevirtual0x807FEFD8

Reimplemented from Kinoko::Field::ObjectBase.

Definition at line 58 of file ObjectPillar.cc.

◆ loadFlags()

LoadFlags Kinoko::Field::ObjectPillar::loadFlags ( ) const
inlinenodiscardoverridevirtual0x807FFA2C

Returns a bitmask indicating which lifecycle hooks should be called for the object.

Returns
No flags set by default

In Kinoko, the only effective behavior of this bitmask is to determine whether calc() should be called. The other bits are unused.

Reimplemented from Kinoko::Field::ObjectBase.

Definition at line 73 of file ObjectPillar.hh.

Member Data Documentation

◆ m_base

ObjectPillarBase* Kinoko::Field::ObjectPillar::m_base
private

Stationary portion of pillar.

Definition at line 98 of file ObjectPillar.hh.

◆ m_collidable

ObjectPillarC* Kinoko::Field::ObjectPillar::m_collidable
private

Wall and hazard collision of the upright/falling pillar.

Definition at line 99 of file ObjectPillar.hh.

◆ m_fallStart

const u32 Kinoko::Field::ObjectPillar::m_fallStart
private

The number of frames before the pillar will start to fall.

Definition at line 94 of file ObjectPillar.hh.

◆ m_groundFrame

s32 Kinoko::Field::ObjectPillar::m_groundFrame
private

Frame the pillar has finished falling.

Definition at line 101 of file ObjectPillar.hh.

◆ m_initRot

const f32 Kinoko::Field::ObjectPillar::m_initRot
private

Definition at line 96 of file ObjectPillar.hh.

◆ m_setupRot

EGG::Vector3f Kinoko::Field::ObjectPillar::m_setupRot
private

Initial rotation of the pillar.

Definition at line 97 of file ObjectPillar.hh.

◆ m_state

State Kinoko::Field::ObjectPillar::m_state
private

0 when upright, 1 when falling, and 2 afterwards.

Definition at line 93 of file ObjectPillar.hh.

◆ m_targetRotation

const f32 Kinoko::Field::ObjectPillar::m_targetRotation
private

How much the pillar rotates during the fall, in radians.

Definition at line 95 of file ObjectPillar.hh.

◆ m_workMat

EGG::Matrix34f Kinoko::Field::ObjectPillar::m_workMat
private

Rotation and translation matrix;.

Definition at line 100 of file ObjectPillar.hh.