diff options
author | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2017-05-25 06:37:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-25 06:37:42 +0200 |
commit | bae3799bd5208d08bb52546ad0723103c94cada3 (patch) | |
tree | e4c921df6bf28cdeb50f48d1b7aa4d7a0bc002ed /src/common | |
parent | Merge pull request #2683 from bunnei/telemetry-framework (diff) | |
parent | gl_rasterizer: implement procedural texture (diff) | |
download | yuzu-bae3799bd5208d08bb52546ad0723103c94cada3.tar yuzu-bae3799bd5208d08bb52546ad0723103c94cada3.tar.gz yuzu-bae3799bd5208d08bb52546ad0723103c94cada3.tar.bz2 yuzu-bae3799bd5208d08bb52546ad0723103c94cada3.tar.lz yuzu-bae3799bd5208d08bb52546ad0723103c94cada3.tar.xz yuzu-bae3799bd5208d08bb52546ad0723103c94cada3.tar.zst yuzu-bae3799bd5208d08bb52546ad0723103c94cada3.zip |
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/vector_math.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/common/vector_math.h b/src/common/vector_math.h index 7ca8e15f5..c7a461a1e 100644 --- a/src/common/vector_math.h +++ b/src/common/vector_math.h @@ -652,6 +652,16 @@ static inline decltype((X{} * int{} + X{} * int{}) / base) LerpInt(const X& begi return (begin * (base - t) + end * t) / base; } +// bilinear interpolation. s is for interpolating x00-x01 and x10-x11, and t is for the second +// interpolation. +template <typename X> +inline auto BilinearInterp(const X& x00, const X& x01, const X& x10, const X& x11, const float s, + const float t) { + auto y0 = Lerp(x00, x01, s); + auto y1 = Lerp(x10, x11, s); + return Lerp(y0, y1, t); +} + // Utility vector factories template <typename T> static inline Vec2<T> MakeVec(const T& x, const T& y) { |