From 009f264c3d98f742bec9aaeaafe86d66ad5116a5 Mon Sep 17 00:00:00 2001 From: navewindre Date: Tue, 4 Dec 2018 19:56:23 +0100 Subject: dadffsad --- cheat/internal_rewrite/math.hpp | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) (limited to 'cheat/internal_rewrite/math.hpp') diff --git a/cheat/internal_rewrite/math.hpp b/cheat/internal_rewrite/math.hpp index b965600..188bafd 100644 --- a/cheat/internal_rewrite/math.hpp +++ b/cheat/internal_rewrite/math.hpp @@ -23,34 +23,55 @@ NAMESPACE_REGION( math ) #undef min #undef max -template < typename t > +template < typename t > __forceinline t min( const t& t1, const t& t2 ) { return t1 < t2 ? t1 : t2; } -template < typename t, typename... ts_ > +template < typename t, typename... ts_ > __forceinline t min( const t& t1, const t& t2, ts_&&... ts ) { return t1 < t2 ? min( t1, std::forward< ts_ >( ts )... ) : min( t2, std::forward< ts_ >( ts )... ); } -template < typename t > +template < typename t > __forceinline t max( const t& t1, const t& t2 ) { return t1 > t2 ? t1 : t2; } -template < typename t, typename... ts_ > +template < typename t, typename... ts_ > __forceinline t max( const t& t1, const t& t2, ts_&&... ts ) { return t1 > t2 ? max( t1, std::forward< ts_ >( ts )... ) : max( t2, std::forward< ts_ >( ts )... ); } -template < typename t > +template < typename t > __forceinline t lerp( const t& t1, const t& t2, float progress ) { return t1 + ( t2 - t1 ) * progress; } +//don't code on acid +template < typename t > __forceinline +t ease_in( const t& t1, const t& t2, float progress ) { + progress = progress * progress; + + return t1 + ( t2 - t1 ) * progress; +} + +template < typename t > __forceinline +t ease_out( const t& t1, const t& t2, float progress ) { + progress = progress * ( 2 - progress ); + + return t1 + ( t2 - t1 ) * progress; +} + +template < typename t > __forceinline +t ease_inout( const t& t1, const t& t2, float progress ) { + progress = progress < 0.5f ? 2 * progress * progress : -1 + ( 4 - 2 * progress ) * progress; + + return t1 + ( t2 - t1 ) * progress; +} // todo - dex; make 2 random generator funcs here, this one only works for floats normally -- cgit v1.2.3