resonance 1.0.1
Loading...
Searching...
No Matches
Rnd::Animatable::SecondOrder Class Reference

Filter stage that drives the value with a spring and a damper. More...

#include <animatable.h>

Inheritance diagram for Rnd::Animatable::SecondOrder:
Collaboration diagram for Rnd::Animatable::SecondOrder:

Public Member Functions

 SecondOrder ()
 Construct a stage at rest with indeterminate spring parameters.
 SecondOrder (float flLevel, float flSpring, float flDamper)
 Construct a stage at rest with all three parameters set.
virtual float Apply (float flValue)
 Integrate the spring and the damper by one step.
virtual float Unapply (float flValue)
 Report the mLevel that preceded the last Apply().
virtual void Print (Dbg &sink) const
 Write "(level:%.2f spring:%.2f damper:)%.2f vel%.2f" to sink.
virtual void Save (Stream &stream)
 Write the three spring parameters to stream, the velocity excluded.
virtual void Load (Stream &stream)
 Read the three spring parameters from stream, the velocity excluded.
virtual int Type ()
 Report kFilterSecondOrder.
virtual void Copy (const Filter *pSource)
 Copy all four members from pSource.

Detailed Description

Filter stage that drives the value with a spring and a damper.

Its RTTI descriptor is at 0x008eefa8. It derives publicly from Filter at offset 0. The object is 0x14 bytes, and its vtable is at 0x0081e860.

The stage is stateful in two members. mLevel is the running output and mVel the running velocity. Each Apply() accelerates the velocity towards the incoming value and then integrates it once.

Constructor & Destructor Documentation

◆ SecondOrder() [1/2]

Rnd::Animatable::SecondOrder::SecondOrder ( )
inline

Construct a stage at rest with indeterminate spring parameters.

NewFilter() clears mVel and writes nothing else beyond the vtable pointer.

◆ SecondOrder() [2/2]

Rnd::Animatable::SecondOrder::SecondOrder ( float flLevel,
float flSpring,
float flDamper )
inline

Construct a stage at rest with all three parameters set.

Parameters
flLevelThe starting output.
flSpringThe acceleration per unit of distance to the input.
flDamperThe fraction of the velocity shed each Apply().

Member Function Documentation

◆ Apply()

virtual float Rnd::Animatable::SecondOrder::Apply ( float flValue)
virtual

Integrate the spring and the damper by one step.

Parameters
flValueThe value to move towards.
Returns
The new mLevel.
Ghidra address:
NTSC-U/C: 0x0049a5f8
Ghidra address:
PAL: 0x004d8560

Implements Rnd::Animatable::Filter.

◆ Unapply()

virtual float Rnd::Animatable::SecondOrder::Unapply ( float flValue)
virtual

Report the mLevel that preceded the last Apply().

The argument is ignored. One step back is the current level less the current velocity.

Parameters
flValueThe value the last Apply() received.
Returns
The earlier level.
Ghidra address:
NTSC-U/C: 0x0049a630
Ghidra address:
PAL: 0x004d8598

Reimplemented from Rnd::Animatable::Filter.

◆ Print()

virtual void Rnd::Animatable::SecondOrder::Print ( Dbg & sink) const
virtual

Write "(level:%.2f spring:%.2f damper:)%.2f vel%.2f" to sink.

The closing bracket lands one call too early in the binary, in front of the damper value instead of after the velocity, and the " vel" label has no colon. Both are faults of the original text rather than of the recovery.

Parameters
sinkThe diagnostic sink to write to.
Ghidra address:
NTSC-U/C: 0x00499700
Ghidra address:
PAL: 0x004d7660

Implements Rnd::Animatable::Filter.

◆ Save()

virtual void Rnd::Animatable::SecondOrder::Save ( Stream & stream)
virtual

Write the three spring parameters to stream, the velocity excluded.

Parameters
streamThe stream to write to.
Ghidra address:
NTSC-U/C: 0x00499800
Ghidra address:
PAL: 0x004d7760

Implements Rnd::Animatable::Filter.

◆ Load()

virtual void Rnd::Animatable::SecondOrder::Load ( Stream & stream)
virtual

Read the three spring parameters from stream, the velocity excluded.

A stage read this way therefore retains whatever velocity it already had, and one built by NewFilter() starts at rest.

Parameters
streamThe stream to read from.
Ghidra address:
NTSC-U/C: 0x00499890
Ghidra address:
PAL: 0x004d77f0

Implements Rnd::Animatable::Filter.

◆ Type()

virtual int Rnd::Animatable::SecondOrder::Type ( )
virtual

Report kFilterSecondOrder.

Returns
The type tag.
Ghidra address:
NTSC-U/C: 0x00499908
Ghidra address:
PAL: 0x004d7868

Implements Rnd::Animatable::Filter.

◆ Copy()

virtual void Rnd::Animatable::SecondOrder::Copy ( const Filter * pSource)
virtual

Copy all four members from pSource.

Parameters
pSourceThe SecondOrder to copy.
Ghidra address:
NTSC-U/C: 0x00499910
Ghidra address:
PAL: 0x004d7870

Implements Rnd::Animatable::Filter.


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