group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
CharacterRig Class Reference

Shared skinned rig — skeleton + bind-pose meshes + joint map. More...

#include <CharacterRig.hpp>

Classes

struct  Impl

Public Member Functions

 CharacterRig ()
 ~CharacterRig ()
 CharacterRig (const CharacterRig &)=delete
CharacterRigoperator= (const CharacterRig &)=delete
 CharacterRig (CharacterRig &&) noexcept
CharacterRigoperator= (CharacterRig &&) noexcept
bool loadFromFBX (const std::string &path, const glm::quat &orientationFix=glm::quat(1.0f, 0.0f, 0.0f, 0.0f), bool flipNormals=false, bool flipUVs=false)
 Load rig from an FBX/GLB file.
bool isLoaded () const noexcept
 True after a successful loadFromFBX().
int numJoints () const noexcept
 Number of skeleton joints. 0 if not loaded.
const ozz::animation::Skeleton * skeleton () const noexcept
 ozz skeleton (owning). Null if not loaded.
const std::vector< glm::mat4 > & inverseBindMatrices () const noexcept
 Inverse bind matrices, one per joint (identity for structural joints).
const std::vector< RigMeshData > & meshes () const noexcept
 Per-mesh bind-pose + weight data.
const std::unordered_map< std::string, int > & jointMap () const noexcept
 Joint name → runtime index map.
const std::unordered_map< std::string, anim_utils::JointRestPose > & restPoses () const noexcept
 Rest-pose local transforms keyed by joint name (used by the animation library to build single-key tracks for joints that lack an animation channel in a given clip).
void verticalBounds (float &outMinY, float &outMaxY) const
 Compute the vertical (Y) extent of the bind-pose mesh.

Private Attributes

std::unique_ptr< Implimpl_

Detailed Description

Shared skinned rig — skeleton + bind-pose meshes + joint map.

Loaded once from a single FBX (the one containing skin data, e.g. standard_walk.fbx). Animation clips come from AnimationLibrary on top of this rig. Per-entity state lives in CharacterAnimator.

Constructor & Destructor Documentation

◆ CharacterRig() [1/3]

CharacterRig::CharacterRig ( )
Here is the caller graph for this function:

◆ ~CharacterRig()

CharacterRig::~CharacterRig ( )
default

◆ CharacterRig() [2/3]

CharacterRig::CharacterRig ( const CharacterRig & )
delete
Here is the call graph for this function:

◆ CharacterRig() [3/3]

CharacterRig::CharacterRig ( CharacterRig && )
defaultnoexcept
Here is the call graph for this function:

Member Function Documentation

◆ inverseBindMatrices()

const std::vector< glm::mat4 > & CharacterRig::inverseBindMatrices ( ) const
nodiscardnoexcept

Inverse bind matrices, one per joint (identity for structural joints).

Here is the caller graph for this function:

◆ isLoaded()

bool CharacterRig::isLoaded ( ) const
nodiscardnoexcept

True after a successful loadFromFBX().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ jointMap()

const std::unordered_map< std::string, int > & CharacterRig::jointMap ( ) const
nodiscardnoexcept

Joint name → runtime index map.

Here is the caller graph for this function:

◆ loadFromFBX()

bool CharacterRig::loadFromFBX ( const std::string & path,
const glm::quat & orientationFix = glm::quat(1.0f, 0.0f, 0.0f, 0.0f),
bool flipNormals = false,
bool flipUVs = false )

Load rig from an FBX/GLB file.

Parameters
pathAbsolute path to a file with a skin-weighted mesh.
orientationFixRotation prepended to the skeleton root so the whole rig (render mesh, joint frames, hitboxes) is re-oriented consistently. Defaults to identity. Needed when a re-export changes the up/forward axis convention (e.g. a glTF export of a rig whose armature carried an unapplied 90° rotation).
flipNormalsNegate every bind-pose vertex normal. Defaults to false. Use when an export inverts normal/winding handedness so the lit surface faces the wrong way.
flipUVsApply aiProcess_FlipUVs. Defaults to false. Matches the static model loader's glTF-vs-DCC convention so skinned viewmodel meshes sample their textures right-side-up.
Returns
True on success (skeleton built + at least one skinned mesh).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ meshes()

const std::vector< RigMeshData > & CharacterRig::meshes ( ) const
nodiscardnoexcept

Per-mesh bind-pose + weight data.

Here is the caller graph for this function:

◆ numJoints()

int CharacterRig::numJoints ( ) const
nodiscardnoexcept

Number of skeleton joints. 0 if not loaded.

Here is the caller graph for this function:

◆ operator=() [1/2]

CharacterRig & CharacterRig::operator= ( CharacterRig && )
defaultnoexcept
Here is the call graph for this function:

◆ operator=() [2/2]

CharacterRig & CharacterRig::operator= ( const CharacterRig & )
delete
Here is the call graph for this function:

◆ restPoses()

const std::unordered_map< std::string, anim_utils::JointRestPose > & CharacterRig::restPoses ( ) const
nodiscardnoexcept

Rest-pose local transforms keyed by joint name (used by the animation library to build single-key tracks for joints that lack an animation channel in a given clip).

Here is the caller graph for this function:

◆ skeleton()

const ozz::animation::Skeleton * CharacterRig::skeleton ( ) const
nodiscardnoexcept

ozz skeleton (owning). Null if not loaded.

Here is the caller graph for this function:

◆ verticalBounds()

void CharacterRig::verticalBounds ( float & outMinY,
float & outMaxY ) const

Compute the vertical (Y) extent of the bind-pose mesh.

Scans all vertices across all meshes and returns the minimum and maximum Y coordinates. Used to auto-calculate the rig scale so the animated model matches the player's collision AABB height.

Here is the caller graph for this function:

Member Data Documentation

◆ impl_

std::unique_ptr<Impl> CharacterRig::impl_
private

The documentation for this class was generated from the following files: