resonance 1.0.1
Loading...
Searching...
No Matches
Rnd::TransAnim::RotKey Class Reference

One keyframe of the rotation channel. More...

#include <transanim.h>

Collaboration diagram for Rnd::TransAnim::RotKey:

Public Member Functions

void ComputeSplineTangents (const RotKey *pPrev, const RotKey *pNext)
 Build the two Kochanek-Bartels tangents of this keyframe from its neighbours.
void EvaluateSpline (const RotKey *pNext, Quat &out, float flT) const
 Evaluate the spherical Bezier segment from this keyframe to pNext.
bool operator< (const RotKey &other) const
 Order keyframes by frame.

Public Attributes

Quat mQuat
Quat mTangentIn
Quat mTangentOut
float mShape [kXfmRowFloatCount]
float mFrame

Detailed Description

One keyframe of the rotation channel.

The same 0x50 bytes as TransKey, and the same node placement. The value is a quaternion rather than a vector, so all four floats are read, written, and dumped. The dumper at 0x004f9160 labels the value "q:" and its components "x:", "y:", "z:", and "w:".

Member Function Documentation

◆ ComputeSplineTangents()

void Rnd::TransAnim::RotKey::ComputeSplineTangents ( const RotKey * pPrev,
const RotKey * pNext )

Build the two Kochanek-Bartels tangents of this keyframe from its neighbours.

Every blend is a QuatSlerp(). With both neighbours present, toPrev is the slerp of this key towards pPrev at -(bias + 1) / 3 and toNext the slerp towards pNext at (1 - bias) / 3. mTangentOut is then the slerp of this key towards the slerp of that pair at (1 - continuity) / 2, weighted 1 - tension, and mTangentIn the same with (1 + continuity) / 2 and tension - 1. The two end weights differ only in sign, which is what opposes the two tangents. A keyframe with no previous neighbour writes only mTangentOut, as the slerp towards pNext at (1 - tension) * (continuity * bias + 1) / 3, and one with no next neighbour writes only mTangentIn, as the slerp towards pPrev at (1 - tension) * (1 - continuity * bias) / 3. A keyframe with neither neighbour is unchanged.

Parameters
pPrevThe preceding keyframe, or null at the start of the channel.
pNextThe following keyframe, or null at the end of the channel.
Ghidra address:
NTSC-U/C: 0x00552588
Ghidra address:
PAL: 0x00592bc8

◆ EvaluateSpline()

void Rnd::TransAnim::RotKey::EvaluateSpline ( const RotKey * pNext,
Quat & out,
float flT ) const

Evaluate the spherical Bezier segment from this keyframe to pNext.

The control points are mQuat, mTangentOut, pNext->mTangentIn, and pNext->mQuat. Three rounds of QuatSlerp() at the one parameter reduce the four points to three, then two, then the result. A parameter of exactly zero or exactly one copies the matching end quaternion.

Parameters
pNextThe keyframe that ends the segment.
outReceives the rotation.
flTThe segment parameter, zero at this keyframe and one at pNext.
Ghidra address:
NTSC-U/C: 0x00554c68
Ghidra address:
PAL: 0x005952f0

◆ operator<()

bool Rnd::TransAnim::RotKey::operator< ( const RotKey & other) const
inline

Order keyframes by frame.

The list sort at 0x00108a50, which TnlBumpFX::Start() and the loader call, inlines it in its merge step at 0x001088e0.

Parameters
otherThe keyframe to compare against.
Returns
Whether this keyframe lands before other.

Member Data Documentation

◆ mQuat

Quat Rnd::TransAnim::RotKey::mQuat

The rotation. +0x00

◆ mTangentIn

Quat Rnd::TransAnim::RotKey::mTangentIn

Tangent entering the key. +0x10

◆ mTangentOut

Quat Rnd::TransAnim::RotKey::mTangentOut

Tangent leaving the key. +0x20

◆ mShape

float Rnd::TransAnim::RotKey::mShape[kXfmRowFloatCount]

See ShapeComponent, then padding. +0x30

◆ mFrame

float Rnd::TransAnim::RotKey::mFrame

Frame this key lands on. +0x40


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