diff options
| author | 2017-04-17 10:01:45 +0300 | |
|---|---|---|
| committer | 2017-05-20 13:50:50 +0300 | |
| commit | ade45b5b9930b52b6a1d399306539073e8e2196d (patch) | |
| tree | 19fc2c287591990b796530c383a1153f4b8fcda5 /src/common/vector_math.h | |
| parent | Merge pull request #2696 from Subv/vfp_revert (diff) | |
| download | yuzu-ade45b5b9930b52b6a1d399306539073e8e2196d.tar.gz yuzu-ade45b5b9930b52b6a1d399306539073e8e2196d.tar.xz yuzu-ade45b5b9930b52b6a1d399306539073e8e2196d.zip | |
pica/swrasterizer: implement procedural texture
Diffstat (limited to 'src/common/vector_math.h')
| -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 | |||
| 652 | return (begin * (base - t) + end * t) / base; | 652 | return (begin * (base - t) + end * t) / base; |
| 653 | } | 653 | } |
| 654 | 654 | ||
| 655 | // bilinear interpolation. s is for interpolating x00-x01 and x10-x11, and t is for the second | ||
| 656 | // interpolation. | ||
| 657 | template <typename X> | ||
| 658 | inline auto BilinearInterp(const X& x00, const X& x01, const X& x10, const X& x11, const float s, | ||
| 659 | const float t) { | ||
| 660 | auto y0 = Lerp(x00, x01, s); | ||
| 661 | auto y1 = Lerp(x10, x11, s); | ||
| 662 | return Lerp(y0, y1, t); | ||
| 663 | } | ||
| 664 | |||
| 655 | // Utility vector factories | 665 | // Utility vector factories |
| 656 | template <typename T> | 666 | template <typename T> |
| 657 | static inline Vec2<T> MakeVec(const T& x, const T& y) { | 667 | static inline Vec2<T> MakeVec(const T& x, const T& y) { |