summaryrefslogtreecommitdiff
path: root/cheat/internal_rewrite/math.hpp
diff options
context:
space:
mode:
authornavewindre <boneyaard@gmail.com>2018-12-04 19:56:23 +0100
committernavewindre <boneyaard@gmail.com>2018-12-04 19:56:23 +0100
commit009f264c3d98f742bec9aaeaafe86d66ad5116a5 (patch)
tree0f928ae839867e117a694cd84c2dcfcf419d330b /cheat/internal_rewrite/math.hpp
parenta7e0ce1fb433a3f1ba34b92b084a2c5e8baf4dfe (diff)
dadffsad
Diffstat (limited to 'cheat/internal_rewrite/math.hpp')
-rw-r--r--cheat/internal_rewrite/math.hpp31
1 files changed, 26 insertions, 5 deletions
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