|
| | CharacterAnimator (const CharacterRig &rig, const AnimationLibrary &library) |
| | ~CharacterAnimator () |
| | CharacterAnimator (const CharacterAnimator &)=delete |
| CharacterAnimator & | operator= (const CharacterAnimator &)=delete |
| | CharacterAnimator (CharacterAnimator &&) noexcept=delete |
| CharacterAnimator & | operator= (CharacterAnimator &&) noexcept=delete |
| void | setSkinningBackend (const ISkinningBackend *backend) |
| | Set the skinning backend (non-owning).
|
| void | update (const AnimationInputs &inputs, float dt) |
| | Advance the state machine, sample + blend, and compute skin matrices.
|
| void | renderFromServer (const AnimSnapshot &serverState, const AnimationInputs &inputs) |
| | PR-29: render the entity at server-authoritative animation state.
|
| void | computeSkinnedVertices (std::vector< std::vector< ModelVertex > > &out) const |
| | Apply CPU skinning to every rig mesh, producing animated vertices.
|
| void | setDebugOverride (ClipId id, bool loop=true) |
| | Force a single clip to play, bypassing the graph.
|
| ClipId | debugOverride () const noexcept |
| | Current debug override clip (_Count = no override).
|
| const std::array< ClipSampler, kNumSamplerSlots > & | samplers () const noexcept |
| | Snapshot of the current sampler slots (for UI inspection).
|
| void | setDebugPlaybackSpeed (float mul) noexcept |
| | Playback-speed multiplier applied in debug-override mode.
|
| void | applyWeaponHoldPose (const WeaponHoldPose &pose, float weight) |
| | Pose both arms (and the gun-holding fingers) for a held weapon.
|
| void | updateSkinMatrices () |
| | Recompute skinMatrices() = jointModelMats * inverseBindMats.
|
| void | applyRecoilImpulse (float strengthRad) |
| | Phase F additive recoil kick.
|
| int | numJoints () const noexcept |
| | Number of joints in the underlying rig.
|
| int | currentModeValue () const noexcept |
| | Current high-level animator mode as the underlying int of the private Mode enum (0 = Locomotion, then Crouch, Airborne, Slide, WallRun, …).
|
| void | setFrozen (bool frozen) noexcept |
| | Freeze animation playback.
|
| const std::vector< glm::mat4 > & | jointModelMatrices () const noexcept |
| | Model-space joint matrices with all procedural transforms applied (head pitch, wallrun mirror) but WITHOUT inverse-bind-matrix multiplication.
|
| const std::vector< glm::mat4 > & | skinMatrices () const noexcept |
| | Per-joint LBS skin matrices: procedural * modelMat * inverseBind.
|
Per-entity animator.
Runs a small state machine that chooses which clips play, samples + blends them via ozz, converts to model-space matrices, and hands off to the skinning backend to produce deformed vertices.
Needs non-owning references to the shared rig + clip library + skinning backend, all of which must outlive the animator.
| void CharacterAnimator::applyRecoilImpulse |
( |
float | strengthRad | ) |
|
Phase F additive recoil kick.
Pushes an instantaneous upward pitch impulse onto the spine that decays exponentially over ~250 ms (impl detail). Called once per fired shot from the client's weapon system; the animator integrates the decay each frame inside runSamplingAndSkinning.
strengthRad is the peak additional pitch in radians, typically 0.05–0.15 (≈3–8 degrees) for a rifle and larger for heavier weapons.
| void CharacterAnimator::applyWeaponHoldPose |
( |
const WeaponHoldPose & | pose, |
|
|
float | weight ) |
Pose both arms (and the gun-holding fingers) for a held weapon.
Pure forward kinematics — no IK solving. Each bone in the chain Shoulder → UpperArm → ForeArm → Hand (plus every finger joint) is driven to its authored local rotation from pose, processed root → tip so the chain stays connected. weight ∈ [0,1] slerps from the sampled animation toward the authored hold pose (used for the weapon-swap fade); 1.0 fully replaces the arm animation with the static hold.
Mutates jointModelMatrices() in place and recomputes skinMatrices() at the end. Call once per frame after update()/renderFromServer().
| int CharacterAnimator::currentModeValue |
( |
| ) |
const |
|
nodiscardnoexcept |
Current high-level animator mode as the underlying int of the private Mode enum (0 = Locomotion, then Crouch, Airborne, Slide, WallRun, …).
Callers should treat the value as opaque.
| const std::vector< glm::mat4 > & CharacterAnimator::jointModelMatrices |
( |
| ) |
const |
|
nodiscardnoexcept |
Model-space joint matrices with all procedural transforms applied (head pitch, wallrun mirror) but WITHOUT inverse-bind-matrix multiplication.
These are the matrices needed for hitbox capsule placement — each matrix transforms from bone-local space to the rig's model space. Apply the entity's world transform (position + yaw + scale) on top to get world space.
Valid after a call to update(). Size = numJoints().
PR-29: render the entity at server-authoritative animation state.
Bypasses the per-instance state machine (steps 1-6 of update()) — instead writes the supplied AnimSnapshot directly into the internal samplers and runs the ozz sampling + blending + LocalToModel pipeline on top. Used by the client renderer for REMOTE players whose animation state is replicated from the server via the snapshot stream; eliminates the residual ~0.4- median anim-state drift PR-27a's telemetry caught (server runs animator at 128 Hz, client at 30 Hz; both at 1.0× speed but per-clip start-time offsets persist for the lifetime of each clip).
The local player still uses update() — its prediction-driven state machine is authoritative client-side.
inputs is still consulted for per-frame post-processing that has no analog in the snapshot (head-pitch transform, wallrun mirror). Pass the SAME interp-delayed inputs you would have passed to update().