NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
m3d::calcRatio_c Class Reference

#include <game/mLib/m_3d/calc_ratio.hpp>

Description

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.
 

Constructor & Destructor Documentation

◆ calcRatio_c()

m3d::calcRatio_c::calcRatio_c ( )

Constructs a ratio calculator.

Definition at line 4 of file calc_ratio.cpp.

◆ ~calcRatio_c()

virtual m3d::calcRatio_c::~calcRatio_c ( )
inlinevirtual

Destroys the ratio calculator.

Definition at line 15 of file calc_ratio.hpp.

Member Function Documentation

◆ isEnd()

bool m3d::calcRatio_c::isEnd ( ) const

Returns whether the blend is complete.

Definition at line 77 of file calc_ratio.cpp.

◆ calc()

void m3d::calcRatio_c::calc ( )

Advances the blend by one time step.

Definition at line 51 of file calc_ratio.cpp.

◆ set()

void m3d::calcRatio_c::set ( float duration)

Starts a blend with a given duration.

Definition at line 36 of file calc_ratio.cpp.

◆ remove()

void m3d::calcRatio_c::remove ( )

Cancels and resets the blend.

Definition at line 17 of file calc_ratio.cpp.

◆ reset()

void m3d::calcRatio_c::reset ( )

Resets the blend to its initial state.

Definition at line 22 of file calc_ratio.cpp.

◆ offUpdate()

void m3d::calcRatio_c::offUpdate ( )

Pauses the blend.

Definition at line 31 of file calc_ratio.cpp.

◆ getScaleFrom()

float m3d::calcRatio_c::getScaleFrom ( )
inline

Definition at line 24 of file calc_ratio.hpp.

◆ getScaleTo()

float m3d::calcRatio_c::getScaleTo ( )
inline

Definition at line 25 of file calc_ratio.hpp.

◆ getSlerpParam()

float m3d::calcRatio_c::getSlerpParam ( )
inline

Definition at line 26 of file calc_ratio.hpp.

◆ isActive()

bool m3d::calcRatio_c::isActive ( ) const
inline

Definition at line 28 of file calc_ratio.hpp.

◆ isBlending()

bool m3d::calcRatio_c::isBlending ( ) const
inline

Definition at line 29 of file calc_ratio.hpp.

Member Data Documentation

◆ mWeight

float m3d::calcRatio_c::mWeight
private

Current weight of the blend.

Definition at line 32 of file calc_ratio.hpp.

◆ mT

float m3d::calcRatio_c::mT
private

The current time of the blend, between 0 and 1.

Definition at line 33 of file calc_ratio.hpp.

◆ mTimeStep

float m3d::calcRatio_c::mTimeStep
private

How much to advance mT by each iteration.

Definition at line 34 of file calc_ratio.hpp.

◆ mScaleFrom

float m3d::calcRatio_c::mScaleFrom
private

How much to multiply the old value by (between 0 and 1).

Definition at line 36 of file calc_ratio.hpp.

◆ mScaleTo

float m3d::calcRatio_c::mScaleTo
private

How much to multiply the new value by (between 0 and 1).

Definition at line 37 of file calc_ratio.hpp.

◆ mInterpolateT

float m3d::calcRatio_c::mInterpolateT
private

If using an interpolation function, use this as the t parameter.

Definition at line 38 of file calc_ratio.hpp.

◆ mIsActive

bool m3d::calcRatio_c::mIsActive
private

Whether the blend is paused.

Definition at line 40 of file calc_ratio.hpp.

◆ mIsBlending

bool m3d::calcRatio_c::mIsBlending
private

Whether the blend is active.

Definition at line 41 of file calc_ratio.hpp.