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

One keyframe of the translation or the scale channel. More...

#include <transanim.h>

Public Member Functions

void ComputeSplineTangents (const TransKey *pPrev, const TransKey *pNext)
 Build the two Kochanek-Bartels tangents of this keyframe from its neighbours.
void EvaluateSpline (const TransKey *pNext, float *pOut, float flT) const
 Evaluate the cubic Hermite segment from this keyframe to pNext.
Vector3 EvaluateSplineDerivative (const TransKey *pNext, float flT) const
 Evaluate the derivative of the segment EvaluateSpline() traces.
bool operator< (const TransKey &other) const
 Order keyframes by frame.

Public Attributes

float mValue [kXfmRowFloatCount]
float mTangentIn [kXfmRowFloatCount]
float mTangentOut [kXfmRowFloatCount]
float mShape [kXfmRowFloatCount]
float mFrame

Detailed Description

One keyframe of the translation or the scale channel.

The keyframe is 0x50 bytes, and the enclosing std::list node is 0x60 with the value at +0x10, both of which follow from the 16-byte alignment the padded vectors impose. mFrame lands at +0x40 rather than at +0x3c for the same reason, which is what makes the shape triple a padded vector rather than three loose floats.

The assignment of the shape triple is settled by the arithmetic of the tangent builder at 0x00552748, which forms 1 - tension, (1 +- continuity) / 2, and 1 +- bias. That is the Kochanek-Bartels weighting, and it agrees with the "t:", "c:", and "b:" titles the dumper writes in that order.

Member Function Documentation

◆ ComputeSplineTangents()

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

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

With both neighbours, toPrev is (value - pPrev->value) * (bias + 1) and toNext is (pNext->value - value) * (1 - bias). mTangentOut is then toPrev + (toNext - toPrev) * (0.5 - continuity / 2) weighted 1 - tension, and mTangentIn the same with 0.5 + continuity / 2. A keyframe with no previous neighbour writes only mTangentOut, as ((pNext->value - value) * 1.5 - pNext->mTangentIn * 0.5 * (bias + 1)) * (1 - tension), and one with no next neighbour writes only mTangentIn, as ((value - pPrev->value) * 1.5 - pPrev->mTangentOut * 0.5 * (bias + 1)) * (1 - tension). Every tangent written ends in a padding float of 1.0. 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: 0x00552748
Ghidra address:
PAL: 0x00592d88

◆ EvaluateSpline()

void Rnd::TransAnim::TransKey::EvaluateSpline ( const TransKey * pNext,
float * pOut,
float flT ) const

Evaluate the cubic Hermite segment from this keyframe to pNext.

The segment leaves mValue along mTangentOut and arrives at pNext->mValue along pNext->mTangentIn. A parameter of exactly zero or exactly one copies the matching value quadword, padding float included. Any other parameter writes a padding float of 1.0.

Parameters
pNextThe keyframe that ends the segment.
pOutReceives the position, four floats.
flTThe segment parameter, zero at this keyframe and one at pNext.
Ghidra address:
NTSC-U/C: 0x00552af8
Ghidra address:
PAL: 0x00593138

◆ EvaluateSplineDerivative()

Vector3 Rnd::TransAnim::TransKey::EvaluateSplineDerivative ( const TransKey * pNext,
float flT ) const

Evaluate the derivative of the segment EvaluateSpline() traces.

Neither end of the segment is special cased. The result returns through the hidden pointer in a0, ahead of this object in a1, and its padding float is 1.0.

Parameters
pNextThe keyframe that ends the segment.
flTThe segment parameter, zero at this keyframe and one at pNext.
Returns
The derivative with respect to the segment parameter.
Ghidra address:
NTSC-U/C: 0x00552cb8
Ghidra address:
PAL: 0x005932f8

◆ operator<()

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

Order keyframes by frame.

The list sort the loader calls inlines it in its merge step.

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

Member Data Documentation

◆ mValue

float Rnd::TransAnim::TransKey::mValue[kXfmRowFloatCount]

x, y, and z, then one padding float. +0x00

◆ mTangentIn

float Rnd::TransAnim::TransKey::mTangentIn[kXfmRowFloatCount]

Tangent entering the key. +0x10

◆ mTangentOut

float Rnd::TransAnim::TransKey::mTangentOut[kXfmRowFloatCount]

Tangent leaving the key. +0x20

◆ mShape

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

See ShapeComponent, then padding. +0x30

◆ mFrame

float Rnd::TransAnim::TransKey::mFrame

Frame this key lands on. +0x40


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