NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
|
#include <game/mLib/m_3d/calc_ratio.hpp>
Class to smoothly blend between two values.
This interpolation is done using a custom interpolation. The mWeight follows an ease-in/ease-out curve and the difference between the previous and current value of this weight is used to compute the actual interpolation.
Definition at line 12 of file calc_ratio.hpp.
Public Member Functions | |
calcRatio_c () | |
Constructs a ratio calculator. | |
virtual | ~calcRatio_c () |
Destroys the ratio calculator. | |
bool | isEnd () const |
Returns whether the blend is complete. | |
void | calc () |
Advances the blend by one time step. | |
void | set (float duration) |
Starts a blend with a given duration. | |
void | remove () |
Cancels and resets the blend. | |
void | reset () |
Resets the blend to its initial state. | |
void | offUpdate () |
Pauses the blend. | |
float | getScaleFrom () |
float | getScaleTo () |
float | getSlerpParam () |
bool | isActive () const |
bool | isBlending () const |
Private Attributes | |
float | mWeight |
Current weight of the blend. | |
float | mT |
The current time of the blend, between 0 and 1. | |
float | mTimeStep |
How much to advance mT by each iteration. | |
float | mScaleFrom |
How much to multiply the old value by (between 0 and 1). | |
float | mScaleTo |
How much to multiply the new value by (between 0 and 1). | |
float | mInterpolateT |
If using an interpolation function, use this as the t parameter. | |
bool | mIsActive |
Whether the blend is paused. | |
bool | mIsBlending |
Whether the blend is active. | |
m3d::calcRatio_c::calcRatio_c | ( | ) |
Constructs a ratio calculator.
Definition at line 4 of file calc_ratio.cpp.
|
inlinevirtual |
Destroys the ratio calculator.
Definition at line 15 of file calc_ratio.hpp.
bool m3d::calcRatio_c::isEnd | ( | ) | const |
Returns whether the blend is complete.
Definition at line 77 of file calc_ratio.cpp.
void m3d::calcRatio_c::calc | ( | ) |
Advances the blend by one time step.
Definition at line 51 of file calc_ratio.cpp.
void m3d::calcRatio_c::set | ( | float | duration | ) |
Starts a blend with a given duration.
Definition at line 36 of file calc_ratio.cpp.
void m3d::calcRatio_c::remove | ( | ) |
Cancels and resets the blend.
Definition at line 17 of file calc_ratio.cpp.
void m3d::calcRatio_c::reset | ( | ) |
Resets the blend to its initial state.
Definition at line 22 of file calc_ratio.cpp.
void m3d::calcRatio_c::offUpdate | ( | ) |
Pauses the blend.
Definition at line 31 of file calc_ratio.cpp.
|
inline |
Definition at line 24 of file calc_ratio.hpp.
|
inline |
Definition at line 25 of file calc_ratio.hpp.
|
inline |
Definition at line 26 of file calc_ratio.hpp.
|
inline |
Definition at line 28 of file calc_ratio.hpp.
|
inline |
Definition at line 29 of file calc_ratio.hpp.
|
private |
Current weight of the blend.
Definition at line 32 of file calc_ratio.hpp.
|
private |
The current time of the blend, between 0 and 1.
Definition at line 33 of file calc_ratio.hpp.
|
private |
How much to advance mT by each iteration.
Definition at line 34 of file calc_ratio.hpp.
|
private |
How much to multiply the old value by (between 0 and 1).
Definition at line 36 of file calc_ratio.hpp.
|
private |
How much to multiply the new value by (between 0 and 1).
Definition at line 37 of file calc_ratio.hpp.
|
private |
If using an interpolation function, use this as the t
parameter.
Definition at line 38 of file calc_ratio.hpp.
|
private |
Whether the blend is paused.
Definition at line 40 of file calc_ratio.hpp.
|
private |
Whether the blend is active.
Definition at line 41 of file calc_ratio.hpp.