medfall

A super great game engine
Log | Files | Refs

commit 40aa75756231db90e95a1d0981a1e41ccd498f3e
parent 6cbdbf980b88131bf236b8125b7691597c37b09b
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Tue, 28 May 2019 16:43:51 +0300

unlerp

Diffstat:
Mintrinsics.h | 5+++++
1 file changed, 5 insertions(+), 0 deletions(-)

diff --git a/intrinsics.h b/intrinsics.h @@ -244,6 +244,11 @@ static T lerp( T a, float t, T b ) { return a * ( 1.0f - t ) + b * t; } +template< typename T > +static T unlerp( T lo, T x, T hi ) { + return ( x - lo ) / ( hi - lo ); +} + /* * these are meant to be used for breaking deep in leaf code on keypresses etc * defined in breakbools.cc