32class RailInterpolator;
82 [[nodiscard]]
virtual const char *
getName()
const;
84 [[nodiscard]]
virtual const char *
getKclName()
const;
228 void linkAnims(
const std::span<const char *> &names,
const std::span<Render::AnmType> types);
Represents a binary resource file which contains object models, textures, and animations.
constexpr Vector3f base(size_t col) const
Get a particular column from a matrix.
virtual void init()
Runs once during race initialization.
void setScale(f32 scale)
Sets the uniform scale of the object and updates the scale flag.
static f32 CalcParabolicDisplacement(f32 initVel, f32 accel, u32 frame)
Solves the standard kinematic equation .
eLoadFlags
Describes whether the object needs to be updated every frame.
EGG::TBitFlag< u8, eFlags > Flags
A bitfield of eFlags that represents the state of the object.
EGG::Vector3f m_scale
The scale of the object.
void resize(f32 radius, f32 maxSpeed)
Resizes the BoxColUnit associated with the object.
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.
Render::DrawMdl * m_drawMdl
The draw model associated with the object.
void subPos(const EGG::Vector3f &v)
Subtracts a vector from the object's position and updates the position matrix flag.
void addRot(const EGG::Vector3f &v)
Adds a vector to the object's rotation and updates the rotation flag.
virtual void load()=0
Loads resources, collision, and registers the object to the ObjectDirector.
void calcTransform()
Updates the transform matrix of the object based on its position and rotation.
Abstract::g3d::ResFile * m_resFile
The resource file associated with the object.
virtual void calc()
Runs once per frame if the Calc flag is set in loadFlags().
static EGG::Vector3f AdjustVecForward(f32 sidewaysScalar, f32 forwardScalar, f32 minSpeed, const EGG::Vector3f &src, EGG::Vector3f forward)
Adjusts a vector based on sideways and forward scalars, ensuring a minimum magnitude.
static EGG::Vector3f RotateAxisAngle(f32 angle, const EGG::Vector3f &axis, const EGG::Vector3f &v1)
Rotates a vector around an arbitrary axis by a given angle.
void setTransform(const EGG::Matrix34f &mat)
Sets the transformation matrix of the object and updates the matrix flag.
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 void SetRotTangentHorizontal(EGG::Matrix34f &mat, const EGG::Vector3f &up, const EGG::Vector3f &tangent)
Sets the rotation of a matrix based on an up vector and a tangent vector.
void enableCollision() const
Re-enables collision checks for this object in the BoxColManager.
EGG::Vector3f m_pos
The position of the object.
void setScale(const EGG::Vector3f &scale)
Sets the scale of the object and updates the scale flag.
const EGG::Vector3f & pos() const
Gets the position of the object in world space.
virtual void loadRail()
Loads the rail interpolator for the object.
EGG::Vector3f m_pendingWork0
Up/forward vector depending on the PendingRotation type.
bool m_rotUpdated
Whether m_rot is up-to-date.
virtual void createCollision()=0
Creates a collision object that inherits from ObjectCollisionBase.
const BoxColUnit * unit() const
Fetches the BoxColUnit associated with the object.
const EGG::Matrix34f & transform()
Gets the transformation matrix of the object.
virtual const char * getName() const
Fetches the name of the object from the ObjectFlowTable.
const System::MapdataGeoObj *const m_mapObj
The KMP object associated with the object.
EGG::Vector3f m_pendingWork1
Tangent vector of the PendingRotation.
virtual const char * getResources() const
Fetches the name of the brres resource file associated with the object, if any.
void setMatrixFromOrthonormalBasisAndPos(const EGG::Vector3f &v)
Sets the transformation matrix based on an orthonormal basis and the object's position.
const EGG::Vector3f & scale() const
Gets the scale of the object.
PendingRotation m_pendingRot
Rotation of m_transform yet to be computed.
ObjectBase(const System::MapdataGeoObj ¶ms)
Constructor.
void unregisterCollision()
Unregisters the BoxColUnit associated with the object from the BoxColManager.
void setPos(const EGG::Vector3f &pos)
Sets the position of the object in world space and updates the position matrix flag.
const ObjectId m_id
The ID of the object.
void disableCollision() const
Disables collision checks for this object in the BoxColManager.
void addPos(const EGG::Vector3f &v)
Adds a vector to the object's position and updates the position matrix flag.
virtual const char * getKclName() const
Fetches the name of the KCL resource associated with the object from the ObjectFlowTable.
virtual void calcModel()
Updates the object's model.
void setRot(const EGG::Vector3f &rot)
Sets the rotation of the object and updates the rotation flag.
virtual void loadAnims()
Links associated animations from the object's resource file to the DrawMdl, if any.
void linkAnims(const std::span< const char * > &names, const std::span< Render::AnmType > types)
Links animations from the object's resource file to the DrawMdl.
void setMatrixTangentTo(const EGG::Vector3f &up, const EGG::Vector3f &tangent)
Sets the object's transformation matrix based on an up vector and a tangent vector.
eFlags
Tracks what properties have changed and require recalculation in the transform matrix.
@ Position
The object's position has changed.
@ Scale
The object's scale has changed.
@ Rotation
The object's rotation has changed.
@ Matrix
The object's transformation matrix has changed.
void setRotNoFlag(const EGG::Vector3f &rot)
Sets the rotation of the object without updating the rotation flag.
virtual void calcCollisionTransform()=0
Updates the position, rotation, and scale of the collision object.
virtual void loadGraphics()
Loads the resources associated with the object, if any.
EGG::Matrix34f m_transform
The 3x4 matrix representing the object's position and rotation.
EGG::TBitFlag< u8, eLoadFlags > LoadFlags
A bitfield of eLoadFlags that represents the update requirements of the object.
void resolvePendingRotation()
Computes the rotation columns of m_transform from the PendingRotation, if any.
RailInterpolator * m_railInterpolator
The rail interpolator associated with the object.
virtual ObjectId id() const
Fetches the unique identifier of the object.
const RailInterpolator * railInterpolator() const
Gets the RailInterpolator associated with the object.
Flags m_flags
The properties of the transform matrix to be recalculated.
void calcRotLock()
Refreshes the object's rotation vector based on its transform matrix.
void subRot(const EGG::Vector3f &v)
Subtracts a vector from the object's rotation and updates the rotation flag.
const EGG::Vector3f & rot() const
Gets the rotation of the object.
virtual LoadFlags loadFlags() const
Returns a bitmask indicating which lifecycle hooks should be called for the object.
PendingRotation
The source of a rotation for m_transform which has not been computed yet.
@ None
m_transform is up-to-date
EGG::Vector3f m_rot
The rotation of the object (in radians).
static EGG::Matrix34f OrthonormalBasis(const EGG::Vector3f &v)
Creates an orthonormal basis from a given vector.
virtual f32 getCollisionRadius() const
Collision radius to use for GJK checks.
virtual const EGG::Vector3f & getPosition() const
The position of the object in world space.
BoxColUnit * m_boxColUnit
The box collision unit associated with the object.
Base class for interpolating along a rail. This class is responsible for calculating the current posi...
ObjectId
Unique identifiers for each object.
@ None
Represents the absence of an object.
Pertains to rendering the kart model.
High-level handling for generic system operations, such as input reading, race configuration,...
Wrapper around an integral type with an enum corresponding to its bits.
constexpr TBitFlag< T, E > & setBit(Es... es)
Sets the corresponding bits for the provided enum values.
constexpr void set(f32 val)
A representation of the boundaries of an entity that has dynamic collision.