summaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
authorwwylele <wwylele@gmail.com>2017-04-17 09:01:45 +0200
committerwwylele <wwylele@gmail.com>2017-05-20 12:50:50 +0200
commitade45b5b9930b52b6a1d399306539073e8e2196d (patch)
tree19fc2c287591990b796530c383a1153f4b8fcda5 /src/common
parentMerge pull request #2696 from Subv/vfp_revert (diff)
downloadyuzu-ade45b5b9930b52b6a1d399306539073e8e2196d.tar
yuzu-ade45b5b9930b52b6a1d399306539073e8e2196d.tar.gz
yuzu-ade45b5b9930b52b6a1d399306539073e8e2196d.tar.bz2
yuzu-ade45b5b9930b52b6a1d399306539073e8e2196d.tar.lz
yuzu-ade45b5b9930b52b6a1d399306539073e8e2196d.tar.xz
yuzu-ade45b5b9930b52b6a1d399306539073e8e2196d.tar.zst
yuzu-ade45b5b9930b52b6a1d399306539073e8e2196d.zip
Diffstat (limited to 'src/common')
-rw-r--r--src/common/vector_math.h10
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) {